Re: [PATCH 1/2 v2] libdecnumber: fixed multiple potential access-out-of bounds errors by moving range conditions before reads.

2024-03-27 Thread Ian McCormack
indicated that I should mention that I do not have write access, since I'm a first-time contributor. On Sat, Feb 3, 2024 at 2:31 PM Ian McCormack wrote: > Multiple `for` loops across `libdecnumber` contain boolean expressions > where memory is accessed prior to checking if the pointer is s

[PATCH 1/2] libdecnumber: fixed undefined behavior in `decFloatFMA`

2024-02-02 Thread Ian McCormack
This patch fixes a minor instance of undefined behavior in libdecnumber. It was discovered in the Rust bindings for libdecnumber (`dec`) using a custom version of MIRI that can execute foreign functions. Within the function `decFloatFMA`, the pointer `lo->msd` is initialized to point to a byte

[PATCH 2/2] libdecnumber: fixed undefined behavior in decNumberGetBCD.

2024-02-02 Thread Ian McCormack
This patch fixes a minor instance of undefined behavior in libdecnumber. It was discovered in the Rust bindings for libdecnumber (`dec`) using a custom version of MIRI that can execute foreign functions. On the last iteration of the `while` loop in `decNumberGetBCD`, the pointer `up` will be in

Re: [PATCH 1/2] libdecnumber: fixed undefined behavior in `decFloatFMA`

2024-02-02 Thread Ian McCormack
I've confirmed that these changes fix the error in MIRI, too. I'll post an updated patch once I confirm that there aren't any regressions. On Fri, Feb 2, 2024 at 10:38 AM Jakub Jelinek wrote: > On Fri, Feb 02, 2024 at 04:32:09PM +0100, Jakub Jelinek wrote: > > Anyway, I think all of > > decBasic

[PATCH 1/2 v2] libdecnumber: fixed multiple potential access-out-of bounds errors by moving range conditions before reads.

2024-02-03 Thread Ian McCormack
Multiple `for` loops across `libdecnumber` contain boolean expressions where memory is accessed prior to checking if the pointer is still within a valid range, which can lead to out-of-bounds reads. This patch moves the range conditions to appear before the memory accesses in each conjunction s