bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xgettext bus error on Solaris


From: Bruno Haible
Subject: Re: xgettext bus error on Solaris
Date: Wed, 29 Sep 2004 15:03:31 +0200
User-agent: KMail/1.5

Watts, Simon wrote:
> The cause of the crashes appears to be MessageFormat strings, containing
> braced numbers, for example:
>       "{0} {1}"
> The actual cause is pinned to the first occurance of the sequence
> '{[:space:]*[0-9]'.  If there are no spaces, xgettext crashes.  Subsequent
> braced tokens do not appear to cause problems.

Thanks for the report. The appended patch fixes it.

Bruno


*** gettext-tools/src/format-java.c     15 Jan 2004 11:36:38 -0000      1.6
--- gettext-tools/src/format-java.c     14 May 2004 19:50:34 -0000      1.7
***************
*** 165,170 ****
--- 165,171 ----
          const char *element_start;
          const char *element_end;
          size_t n;
+         char *element_alloced;
          char *element;
          unsigned int number;
          enum format_arg_type type;
***************
*** 194,200 ****
          element_end = format++;
  
          n = element_end - element_start;
!         element = (char *) xallocsa (n + 1);
          memcpy (element, element_start, n);
          element[n] = '\0';
  
--- 195,201 ----
          element_end = format++;
  
          n = element_end - element_start;
!         element = element_alloced = (char *) xallocsa (n + 1);
          memcpy (element, element_start, n);
          element[n] = '\0';
  
***************
*** 202,208 ****
            {
              *invalid_reason =
                xasprintf (_("In the directive number %u, '{' is not followed 
by an argument number."), spec->directives);
!             freesa (element);
              return false;
            }
          number = 0;
--- 203,209 ----
            {
              *invalid_reason =
                xasprintf (_("In the directive number %u, '{' is not followed 
by an argument number."), spec->directives);
!             freesa (element_alloced);
              return false;
            }
          number = 0;
***************
*** 236,242 ****
                    {
                      *invalid_reason =
                        xasprintf (_("In the directive number %u, the substring 
\"%s\" is not a valid date/time style."), spec->directives, element);
!                     freesa (element);
                      return false;
                    }
                }
--- 237,243 ----
                    {
                      *invalid_reason =
                        xasprintf (_("In the directive number %u, the substring 
\"%s\" is not a valid date/time style."), spec->directives, element);
!                     freesa (element_alloced);
                      return false;
                    }
                }
***************
*** 246,252 ****
                  element -= 4;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element);
                  return false;
                }
            }
--- 247,253 ----
                  element -= 4;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element_alloced);
                  return false;
                }
            }
***************
*** 268,274 ****
                    {
                      *invalid_reason =
                        xasprintf (_("In the directive number %u, the substring 
\"%s\" is not a valid number style."), spec->directives, element);
!                     freesa (element);
                      return false;
                    }
                }
--- 269,275 ----
                    {
                      *invalid_reason =
                        xasprintf (_("In the directive number %u, the substring 
\"%s\" is not a valid number style."), spec->directives, element);
!                     freesa (element_alloced);
                      return false;
                    }
                }
***************
*** 278,284 ****
                  element -= 6;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element);
                  return false;
                }
            }
--- 279,285 ----
                  element -= 6;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element_alloced);
                  return false;
                }
            }
***************
*** 295,301 ****
                    ;
                  else
                    {
!                     freesa (element);
                      return false;
                    }
                }
--- 296,302 ----
                    ;
                  else
                    {
!                     freesa (element_alloced);
                      return false;
                    }
                }
***************
*** 305,311 ****
                  element -= 6;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element);
                  return false;
                }
            }
--- 306,312 ----
                  element -= 6;
                  *invalid_reason =
                    xasprintf (_("In the directive number %u, \"%s\" is not 
followed by a comma."), spec->directives, element);
!                 freesa (element_alloced);
                  return false;
                }
            }
***************
*** 313,322 ****
            {
              *invalid_reason =
                xasprintf (_("In the directive number %u, the argument number 
is not followed by a comma and one of \"%s\", \"%s\", \"%s\", \"%s\"."), 
spec->directives, "time", "date", "number", "choice");
!             freesa (element);
              return false;
            }
!         freesa (element);
  
          if (spec->allocated == spec->numbered_arg_count)
            {
--- 314,323 ----
            {
              *invalid_reason =
                xasprintf (_("In the directive number %u, the argument number 
is not followed by a comma and one of \"%s\", \"%s\", \"%s\", \"%s\"."), 
spec->directives, "time", "date", "number", "choice");
!             freesa (element_alloced);
              return false;
            }
!         freesa (element_alloced);
  
          if (spec->allocated == spec->numbered_arg_count)
            {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]