Re: Overflow detection issue in 9.0.2111, 9.0.2109

2023-11-17 Fir de Conversatie Michael Henry
On 11/17/23 06:50, Christian Brabandt wrote: > Thanks both. I have created the following PR to address this > and another issue reported by Coverity: > https://github.com/vim/vim/pull/13539 > > I think it should work as expected now, but please verify. It looks correct to me.  Thanks for the rapid

Re: Overflow detection issue in 9.0.2111, 9.0.2109

2023-11-17 Fir de Conversatie Christian Brabandt
On Fr, 17 Nov 2023, Michael Henry wrote: > Hi, Ernie, > > > I just tried the following as a single compare at entry > > (derived from: x * 10 + digit <= max) > >     if (x > ((INT_MAX - digit) / 10)) return FAIL; > > > AFAICT, it replicates  your results without a separate check > > for addit

Re: Overflow detection issue in 9.0.2111, 9.0.2109

2023-11-17 Fir de Conversatie Michael Henry
Hi, Ernie, > I just tried the following as a single compare at entry > (derived from: x * 10 + digit <= max)     if (x > ((INT_MAX - digit) / 10)) return FAIL; > AFAICT, it replicates  your results without a separate check > for addition. Yes, I think `x > ((INT_MAX - digit) / 10)` is an accura

Re: Overflow detection issue in 9.0.2111, 9.0.2109

2023-11-16 Fir de Conversatie Ernie Rael
Hi Michael, I appreciate seeing your analysis; I did a flawed analysis. I screwed up trying to get it "perfect" with a single compare. I just tried the following as a single compare at entry (derived from: x * 10 + digit <= max) if (x > ((INT_MAX - digit) / 10)) return FAIL; AFAICT, it

Overflow detection issue in 9.0.2111, 9.0.2109

2023-11-16 Fir de Conversatie Michael Henry
All, I noticed these two patches too late to comment on the associated pull request: - patch 9.0.2111: [security]: overflow in get_number: - patch 9.0.2109: [security]: overflow in nv_z_get_count: Both perform overflow detection similarly, verifying that multiplication by 10 does not overflow; i