-Werror=array-bounds

exactlywb@ispras.ru exactlywb@ispras.ru
Thu Sep 8 14:15:44 GMT 2022


Hi! I've noticed that in 81st line of image-header.c file is suspicious:
header = header_buffer - H_START;

As it's written in ISO/IEC 9899:1999:
- Addition or subtraction of a pointer into, or just beyond, an array 
object and an
integer type produces a result that does not point into, or just beyond, 
the same array
object

So it's kinda like ub. It doesn't look really dangerous, but maybe on 
some architectures it can be crashed.

Thanks,
Frolov Daniil


More information about the Elfutils-devel mailing list