The GCC -fanalyzer parameter helped me discover this one.
The status_pipe is being read and processed.
There is a case where the status_pipe is being set but it is not being reset after handling.
In a later loop the pipe does not get read but the previously set state is used bringing the code into a bad state.
Then the loop doesn't do the block buffer used check and this results in the eventual NULL dereference.
range.start = 0;
range.stop = setting->block.used - 1;
+ status_pipe = F_none;
}
// Start Object.
break;
}
- for (; range.start <= range.stop; ++range.start) {
+ for (; range.start <= range.stop && range.start < setting->block.used; ++range.start) {
// Do not handle start/end while inside an ignore set.
if (!(flag & 0x2)) {
break;
}
- for (; range.start <= range.stop; ++range.start) {
+ for (; range.start <= range.stop && range.start < setting->block.used; ++range.start) {
// Do not handle start/end while inside an ignore set.
if (!(flag & 0x2)) {