2002-06-29  Ulrich Drepper  <drepper@redhat.com>

	* catgets/gencat.c (read_input_file): Handle more than one slash
	at end of line correctly [PR libc/3926].
	Based on a patch by Steven Kim <steven.kim@peregrine.com>.

	* catgets/sample.SJIS: Add test case for above bug.
	* catgets/test-gencat.c: Adjust test code.
	* catgets/test-gencat.sh: Adjust expected results.

	* elf/do-rel.h (elf_dynamic_do_rel): Avoid overflow in computation
	to skip relative relocations.
	Patch by Geoff Keating <geoffk@redhat.com>.
This commit is contained in:
Ulrich Drepper 2002-06-29 21:08:13 +00:00
parent a32c7fb447
commit eabea97226
6 changed files with 46 additions and 8 deletions

View File

@ -1,3 +1,17 @@
2002-06-29 Ulrich Drepper <drepper@redhat.com>
* catgets/gencat.c (read_input_file): Handle more than one slash
at end of line correctly [PR libc/3926].
Based on a patch by Steven Kim <steven.kim@peregrine.com>.
* catgets/sample.SJIS: Add test case for above bug.
* catgets/test-gencat.c: Adjust test code.
* catgets/test-gencat.sh: Adjust expected results.
* elf/do-rel.h (elf_dynamic_do_rel): Avoid overflow in computation
to skip relative relocations.
Patch by Geoff Keating <geoffk@redhat.com>.
2002-05-26 Bruno Haible <bruno@clisp.org> 2002-05-26 Bruno Haible <bruno@clisp.org>
* iconv/loop.c (STANDARD_FROM_LOOP_ERR_HANDLER): New macro. * iconv/loop.c (STANDARD_FROM_LOOP_ERR_HANDLER): New macro.

View File

@ -325,15 +325,29 @@ read_input_file (struct catalog *current, const char *fname)
++line_number; ++line_number;
/* It the line continued? */ /* It the line continued? */
continued = 0;
if (buf[act_len - 1] == '\n') if (buf[act_len - 1] == '\n')
{ {
--act_len; --act_len;
continued = buf[act_len - 1] == '\\';
/* There might be more than one backslash at the end of
the line. Only if there is an odd number of them is
the line continued. */
if (buf[act_len - 1] == '\\')
{
int temp_act_len = act_len;
do
{
--temp_act_len;
continued = !continued;
}
while (temp_act_len > 0 && buf[temp_act_len - 1] == '\\');
}
if (continued) if (continued)
--act_len; --act_len;
} }
else
continued = 0;
/* Append to currently selected line. */ /* Append to currently selected line. */
obstack_grow (&current->mem_pool, buf, act_len); obstack_grow (&current->mem_pool, buf, act_len);

View File

@ -8,5 +8,7 @@ $set 1
3 sample3:—\’è•\: 3 sample3:—\’è•\:
4 sample4:TEST\tTAB: 4 sample4:TEST\tTAB:
5 sample5:@”\\t<>\Ží—Þ: 5 sample5:@”\\t<>\Ží—Þ:
6 double slash\\
7 "another line"
$set Another $set Another
FOO "message foo" FOO "message foo"

View File

@ -23,6 +23,8 @@ main (void)
printf ("%s\n", catgets(catalog, 1, 3, "sample 3")); printf ("%s\n", catgets(catalog, 1, 3, "sample 3"));
printf ("%s\n", catgets(catalog, 1, 4, "sample 4")); printf ("%s\n", catgets(catalog, 1, 4, "sample 4"));
printf ("%s\n", catgets(catalog, 1, 5, "sample 5")); printf ("%s\n", catgets(catalog, 1, 5, "sample 5"));
printf ("%s\n", catgets(catalog, 1, 6, "sample 6"));
printf ("%s\n", catgets(catalog, 1, 7, "sample 7"));
catclose (catalog); catclose (catalog);
return 0; return 0;

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Test escape character handling in gencat. # Test escape character handling in gencat.
# Copyright (C) 2000, 2001 Free Software Foundation, Inc. # Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# #
@ -36,12 +36,14 @@ sample2:
sample3:—\è•\: sample3:—\è•\:
sample4:TEST TAB: sample4:TEST TAB:
sample5:@”\ <EFBFBD>í—Þ: sample5:@”\ <EFBFBD>í—Þ:
double slash\
another line
EOF EOF
res=$? res=$?
cat <<EOF | cat <<EOF |
#define AnotherSet 0x2 /* *standard input*:11 */ #define AnotherSet 0x2 /* *standard input*:13 */
#define AnotherFOO 0x1 /* *standard input*:12 */ #define AnotherFOO 0x1 /* *standard input*:14 */
EOF EOF
cmp ${common_objpfx}catgets/test-gencat.h - || res=1 cmp ${common_objpfx}catgets/test-gencat.h - || res=1

View File

@ -1268,7 +1268,9 @@ This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
@item %p @item %p
Either @samp{AM} or @samp{PM}, according to the given time value; or the Either @samp{AM} or @samp{PM}, according to the given time value; or the
corresponding strings for the current locale. Noon is treated as corresponding strings for the current locale. Noon is treated as
@samp{PM} and midnight as @samp{AM}. @samp{PM} and midnight as @samp{AM}. In most locales
@samp{AM}/@samp{PM} format is not supported, in such cases @code{"%p"}
yields an empty string.
@ignore @ignore
We currently have a problem with makeinfo. Write @samp{AM} and @samp{am} We currently have a problem with makeinfo. Write @samp{AM} and @samp{am}
@ -1277,7 +1279,9 @@ both results in `am'. I.e., the difference in case is not visible anymore.
@item %P @item %P
Either @samp{am} or @samp{pm}, according to the given time value; or the Either @samp{am} or @samp{pm}, according to the given time value; or the
corresponding strings for the current locale, printed in lowercase corresponding strings for the current locale, printed in lowercase
characters. Noon is treated as @samp{pm} and midnight as @samp{am}. characters. Noon is treated as @samp{pm} and midnight as @samp{am}. In
most locales @samp{AM}/@samp{PM} format is not supported, in such cases
@code{"%P"} yields an empty string.
This format is a GNU extension. This format is a GNU extension.