Re: [PATCH] fsmonitor: avoid signed integer overflow / infinite loop

2019-06-17 Thread Carlo Arenas
On Sun, Jun 16, 2019 at 6:17 PM Derrick Stolee wrote: > > Thanks for catching this. I wonder if there is a compiler setting or > static analysis that caught this so we can avoid the issue in the future. -Wsign-compare would definitely raise a warning about this, but we have currently 956 of those

Re: [PATCH] fsmonitor: avoid signed integer overflow / infinite loop

2019-06-16 Thread Derrick Stolee
On 6/15/2019 12:11 PM, Carlo Marcelo Arenas Belón wrote: > 883e248b8a ("fsmonitor: teach git to optionally utilize a file system > monitor to speed up detecting new or changed files.", 2017-09-22) uses > an int in a loop that would wrap if index_state->cache_nr (unsigned) > is bigger than INT_MAX

[PATCH] fsmonitor: avoid signed integer overflow / infinite loop

2019-06-15 Thread Carlo Marcelo Arenas Belón
883e248b8a ("fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.", 2017-09-22) uses an int in a loop that would wrap if index_state->cache_nr (unsigned) is bigger than INT_MAX Signed-off-by: Carlo Marcelo Arenas Belón --- fsmonitor.c | 8 +