Bug#602440: Info received (Bug#602440: libxklavier16: Segmentation failure)
YBW
yourbunnywrote at ya.ru
Tue Jan 18 16:42:09 UTC 2011
this patch fix my problem :)
mb bug in
escaped = g_regex_replace(xml_encode_regexen[i], translated, -1,
0, xml_decode_regexen_str[i], 0, NULL);
g_regex_replace forever return NULL
...
translated = escaped
...
and strncat(item->description, translated, XKL_MAX_CI_DESC_LENGTH - 1); try
cat null poitner — translated and catch segfault :)
..
desc_element->children->content — USA
10x
--------------------------------------------------------------------
--- /home/nick/test/libxklavier-5.0/libxklavier/xklavier_config.c 2009-06-24
15:08:38.000000000 +0400
+++ /home/nick/test/libxklavier-5.0_/libxklavier/xklavier_config.c 2011-01-18
19:22:51.000000000 +0300
@@ -142,6 +142,26 @@
#include "libxml/parserInternals.h"
+gchar * replace(gchar *str,size_t max, gchar* from, gchar*to) {
+ gchar *output = malloc(max);
+ gchar *ptr = str;
+ size_t len = 0;
+ for(;*str;str++) {
+ if(len >= max) {
+ break;
+ }
+ if(strstr(str,from) == str) {
+ strncat(output,to,max-len);
+ str+=strlen(from);
+ len+=strlen(to);
+ continue;
+ }
+ output[len++]=*str;
+ }
+ output[len++]=0;
+ return output;
+}
+
gboolean
xkl_read_config_item(XklConfigRegistry * config, gint doc_index,
xmlNodePtr iptr, XklConfigItem * item)
@@ -199,14 +219,11 @@
* The conversion is not using libxml2, because there are no handy
functions in API */
translated =
g_strdup((gchar *) desc_element->children->content);
+
for (i =
sizeof(xml_encode_regexen_str) /
sizeof(xml_encode_regexen_str[0]); --i >= 0;) {
- escaped =
- g_regex_replace(xml_encode_regexen[i],
- translated, -1, 0,
- xml_decode_regexen_str[i], 0,
- NULL);
+ escaped = replace(translated,XKL_MAX_CI_DESC_LENGTH - 1
,xml_encode_regexen_str[i], xml_decode_regexen_str[i]);
g_free(translated);
translated = escaped;
}
@@ -221,14 +238,11 @@
for (i =
sizeof(xml_decode_regexen_str) /
sizeof(xml_decode_regexen_str[0]); --i >= 0;) {
- unescaped =
- g_regex_replace(xml_decode_regexen[i],
- translated, -1, 0,
- xml_encode_regexen_str[i], 0,
- NULL);
+ unescaped = replace(translated, XKL_MAX_CI_DESC_LENGTH - 1,
xml_decode_regexen_str[i],xml_encode_regexen_str[i]);
g_free(translated);
translated = unescaped;
}
+
strncat(item->description,
translated, XKL_MAX_CI_DESC_LENGTH - 1);
g_free(translated);
--------------------------------
On Fri, Nov 5, 2010 at 11:09 PM, Debian Bug Tracking System <
owner at bugs.debian.org> wrote:
> Thank you for the additional information you have supplied regarding
> this Bug report.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
> Debian GNOME Maintainers <pkg-gnome-maintainers at lists.alioth.debian.org>
>
> If you wish to submit further information on this problem, please
> send it to 602440 at bugs.debian.org.
>
> Please do not send mail to owner at bugs.debian.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 602440: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602440
> Debian Bug Tracking System
> Contact owner at bugs.debian.org with problems
>
--
wbr nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20110118/26929f61/attachment-0001.htm>
More information about the pkg-gnome-maintainers
mailing list