Closed kcgen closed 5 years ago
Does this happen without -pedantic
? That flag is not very useful because it usually means pedantic with regards to a very old C spec. Its better to use (when you are using GCC) things like -std=c99
to specify a particular standard.
I got no warning no matter add -Wall -pedantic
or not. My gcc version is 7.4.
I cannot reproduce the warning either. The guards against LONG_MAX were added in 1.3.1 to protect against overflow on systems like win64 where long
is 32 bits, but pointers are 64 bits. There a > 1GB packet could fit in memory, but the storage bound could overflow.
On systems with a 64-bit long it's impossible to allocate enough data to overflow the length, even assuming you had time to submit that many ogg pages. However, technically the guard should be against LONG_MAX
divided by sizeof(*os->lacing_vals)
and it's worth fixing for the sake of 32-bit platforms.
@krcroft , could you offer more informations about how to reproduce the warning? such as your build platform, os name and so on. I had trid some times in Ubuntu 18.04 and some other Linux distributions, but got no warning.
Sorry for the delayed reply; I should have included more detail about architecture. At the time I was compiling for OSX and Windows targets using msys2 and mingw. I will check again with using ogg 1.3.1.
I can't reproduce this today using the current code and stable compiler revisions (tested 9.1, 8.2, and 7.4). Closing!
Feel free to add
-Wall -pedantic
CFLAGS to help catch these if they're not showing up. Cheers.