mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
tests: Fix undefined behaviour.
* tests/test2.c (main): Cast bytes to unsigned before shifting left.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2022-02-07 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
tests: Fix undefined behaviour.
|
||||
* tests/test2.c (main): Cast bytes to unsigned before shifting left.
|
||||
|
||||
2022-01-05 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
Release gperf-3.2.
|
||||
|
||||
@@ -45,7 +45,7 @@ main (int argc, char *argv[])
|
||||
char *p = buf;
|
||||
while (fread (p, 2, 1, stdin) == 1)
|
||||
{
|
||||
if ((p[0] << 8) + p[1] == '\n')
|
||||
if (((unsigned char) p[0] << 8) + (unsigned char) p[1] == '\n')
|
||||
break;
|
||||
p += 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user