|
|
Message-ID: <CAJoZT2hmgFzhh0G1dVjFVeAEBsG+iDQ4CQOs-a2MsyxBjHpkCQ@mail.gmail.com>
Date: Mon, 23 Nov 2026 15:17:42 +0800
From: Wenkai Xing <wenkaixing12@...il.com>
To: musl@...ts.openwall.com
Subject: Bug in getdelim(): high-bit delimiters (>= 128) skipped on slow path
Hello,
We found a bug in getdelim() in musl 1.2.5 on platforms where char is
signed (e.g., x86_64): when a valid delimiter in the range 128..255 is
read through the slow getc_unlocked() path, it is not recognized as the
delimiter.
In src/stdio/getdelim.c:
if (i+1 >= *n) *--f->rpos = c;
else if (((*s)[i++] = c) == delim) break;
Because the value of the assignment expression ((*s)[i++] = c) has type
char, a byte c in 128..255 is converted to a negative signed char (e.g.,
200 -> -56) and then promoted to int before comparing with delim (200),
so the comparison always fails.
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.