From: Daiki Ueno Date: Fri, 28 Nov 2014 04:21:37 +0000 (+0900) Subject: msgfilter: Fix read buffer allocation for empty input X-Git-Tag: v0.19.4~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06e206f5;p=thirdparty%2Fgettext.git msgfilter: Fix read buffer allocation for empty input * msgfilter.c (prepare_read): Increase allocated buffer size even if the original size is < 2. Reported by Robin McCorkell at: . --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index d20a4ff2a..1fdff820e 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,11 @@ +2014-11-28 Daiki Ueno + + msgfilter: Fix read buffer allocation for empty input + * msgfilter.c (prepare_read): Increase allocated buffer size even + if the original size is < 2. + Reported by Robin McCorkell at: + . + 2014-11-27 Daiki Ueno javascript: Simplify Unicode character escape handling diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index fdfb42308..5daced43e 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -554,7 +554,8 @@ prepare_read (size_t *num_bytes_p, void *private_data) if (l->length == l->allocated) { - l->allocated = l->allocated + (l->allocated >> 1); + l->allocated = l->allocated + + (l->allocated < 2 ? 1 : (l->allocated >> 1)); l->result = (char *) xrealloc (l->result, l->allocated); } *num_bytes_p = l->allocated - l->length;