|
|
Message-ID: <alpine.LNX.2.20.13.1707102105360.2537@monopod.intra.ispras.ru>
Date: Mon, 10 Jul 2017 21:11:20 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: [RFC PATCH] fix OOB reads in Xbyte_memmem
On Fri, 30 Jun 2017, Alexander Monakov wrote:
> uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
> uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
^^^^^^^^
Such shifts can invoke UB by shifting 1 into the sign bit. It's easily
amended by making the shift happen in an unsigned type; I'd suggest
something like 'n[0]*1u<<24 | ...' (I've checked that this does not
appear to thwart bswap recognition in GCC)
I assume this would need to be a separate patch, we desired at all.
Alexander
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.