commit ee66c7cb8e4a04b323e694ae483bde53397ee1d7 parent fcba53e32989d59cfd548deaaa6b2bfdc319751c Author: Christian Grothoff <christian@grothoff.org> Date: Wed, 29 Jul 2026 11:08:00 +0200 fix integer promotion issues: unsigned char promotes to int, need uint32_t Diffstat:
| M | src/plugins/deb_extractor.c | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/plugins/deb_extractor.c b/src/plugins/deb_extractor.c @@ -384,10 +384,12 @@ processControlTGZ (struct EXTRACTOR_ExtractContext *ec, sret); off += sret; } - bufSize = cdata[size - 4] - + (cdata[size - 3] << 8) - + (cdata[size - 2] << 16) - + (cdata[size - 1] << 24); + /* The top byte must be widened before it is shifted: `unsigned char' + promotes to `int', and 0x80 << 24 overflows a 32 bit int. */ + bufSize = ((uint32_t) cdata[size - 4]) + + (((uint32_t) cdata[size - 3]) << 8) + + (((uint32_t) cdata[size - 2]) << 16) + + (((uint32_t) cdata[size - 1]) << 24); if (bufSize > MAX_CONTROL_SIZE) { free (cdata);