[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23825: maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstri
bug#23825: maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstrict-overflow
Thu, 23 Jun 2016 09:13:53 +0200
Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
On 06/22/2016 04:37 PM, Jim Meyering wrote:
I would rather fix the code so that it works even if argc is initially
INT_MAX; the code currently has undefined behavior in that case. I have
drafted a patch for this (attached; does not have changelog entries yet)
and will test it a bit. I assume this will fix the warning (don't have
gcc-7 offhand so can't test this).
Building with a recent gcc-7 failed, so I wrote the attached patch. I
think we'll never have 2^31 command line arguments
As the patch shows, a couple of other coreutils programs have a similar
bug; I'm a bit surprised gcc-7 didn't complain about them.
Incidentally, 'yes' has a different bug: it mishandles the case where
'write' succeeds but returns a value less than the buffer size. I'll try
to look into that too. Simplest would be to use stdio (the comments
indicate this has performance issues but I don't know what they are,
anyway correctness trumps performance).
Description: Text Data