From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [RFC PATCH] fix OOB reads in Xbyte_memmem
Date: Mon, 10 Jul 2017 21:11:20 +0300 (MSK) [thread overview]
Message-ID: <alpine.LNX.2.20.13.1707102105360.2537@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20170629213533.18744-1-amonakov@ispras.ru>
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
prev parent reply other threads:[~2017-07-10 18:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 13:37 Out-of-bounds read in twobyte_memmem Leah Neukirchen
2017-06-29 21:35 ` [RFC PATCH] fix OOB reads in Xbyte_memmem Alexander Monakov
2017-06-29 21:48 ` Rich Felker
2017-07-10 18:11 ` Alexander Monakov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.20.13.1707102105360.2537@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).