On Thu, May 11, 2023 at 09:10:19PM -0500, Eric Blake wrote: > > While we were matching 32-bit strtol in qemu_strtoi, our use of a > 64-bit parse was leaking through for some inaccurate answers in > qemu_strtoui in comparison to a 32-bit strtoul. Fix those, and update > the testsuite now that our bounds checks are correct. > > Our int wrappers would be a lot easier to write if libc had a > guaranteed 32-bit parser even on platforms with 64-bit long. > > Fixes: 473a2a331e ("cutils: add qemu_strtoi & qemu_strtoui parsers for > int/unsigned int types", v2.12.0) > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > tests/unit/test-cutils.c | 11 +++++------ > util/cutils.c | 14 ++++++++++---- > 2 files changed, 15 insertions(+), 10 deletions(-)
cc'ing qemu-stable as this is a bug fix, but given its age, it's not a recent regression and therefore probably not essential for backport -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org