This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: libc-alpha at sourceware dot org
- Date: Sat, 23 Apr 2016 22:05:06 +0200
- Subject: Re: [PATCH] tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]
- Authentication-results: sourceware.org; auth=none
- References: <1461359558-26367-1-git-send-email-vapier at gentoo dot org> <87inz8jyxt dot fsf at mid dot deneb dot enyo dot de> <20160423182456 dot GM5369 at vapier dot lan>
* Mike Frysinger:
>> Please use a enum constant of 200, and also pass it to strfmon.
>> K think the current 200/201 choice is technically incorrect
>> (the maximum includes the terminating null byte).
>
> these two tests are both badly written. i've changed it to sizeof.
Thanks. It's also annoying that the file is named tst-fmon, and not
tst-strfmon, which is why I missed it when I contributed
stdlib/tst-strfmon_l.c (it also did not occur to me to look at the
localedata subdirectory). I wonder if we can add an internal
consistency check to tst-fmon and thus get rid of tst-strfmon_l.
(Obviously, this is a separate change.)
I wonder if the malloc allocation was done so that it is possible to
detect overflows in the implementation because that's easier for heap
overflows than for stack overflows. It's the reason why I use malloc
in some tests.
In this case, the buffer length is not even close to what is actually
used by the output, so it's not a valid concern, and the removal of
malloc is appropriate.