[BZ,#17657] Return allocated array instead array on stack.
Commit Message
Hi,
here we return array on stack which is invalid. OK to fix it in obvious way?
[BZ #17657]
* locale/programs/ld-ctype.c (find_translit2): Allocate returned array.
Comments
Ondřej Bílka <neleai@seznam.cz> writes:
> here we return array on stack which is invalid. OK to fix it in obvious way?
The obvious way would be a static allocation.
Andreas.
On Wed, Dec 10, 2014 at 03:09:53PM +0100, Andreas Schwab wrote:
> Ondřej Bílka <neleai@seznam.cz> writes:
>
> > here we return array on stack which is invalid. OK to fix it in obvious way?
>
> The obvious way would be a static allocation.
>
which breaks when user modifies array.
Ondřej Bílka <neleai@seznam.cz> writes:
> On Wed, Dec 10, 2014 at 03:09:53PM +0100, Andreas Schwab wrote:
>> Ondřej Bílka <neleai@seznam.cz> writes:
>>
>> > here we return array on stack which is invalid. OK to fix it in obvious way?
>>
>> The obvious way would be a static allocation.
>>
> which breaks when user modifies array.
Which user?
Andreas.
@@ -1777,7 +1777,7 @@ find_translit2 (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
for (wi = tirunp->from; wi <= wch; wi += tirunp->step)
if (wi == wch)
- return (uint32_t []) { 0 };
+ return (uint32_t *) xcalloc (1, sizeof (uint32_t));
}
}