FD- / RPiPlay

An open-source AirPlay mirroring server for the Raspberry Pi. Supports iOS 9 and up.
GNU General Public License v3.0
4.93k stars 353 forks source link

Missing braces around for loop #197

Closed Zenexer closed 3 years ago

Zenexer commented 3 years ago

https://github.com/FD-/RPiPlay/blob/e485668f752cedf9d1304ca08d5b2f2d03b67063/renderers/h264-bitstream/h264_sei.c#L686-L687

Only the first statement will be looped here (printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left);). Considering the following statements reference i, this is almost certainly undesirable.

This is reported as a warning by GCC (misleading-indentation):

/home/pi/git/RPiPlay/renderers/h264-bitstream/h264_sei.c: In function ‘read_debug_sei_payload’:
/home/pi/git/RPiPlay/renderers/h264-bitstream/h264_sei.c:686:13: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
             for ( i = 0; i < s->payloadSize; i++ )
             ^~~
/home/pi/git/RPiPlay/renderers/h264-bitstream/h264_sei.c:687:80: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
                 printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); s->data[i] = bs_read_u8(b); printf("s->data[i]: %d \n", s->data[i]);
pallas commented 3 years ago

aizvorski/h264bitstream is an upstream library, & while I'm open to accepting compiler lint patches I'd prefer if they were upstream first and we just integrated a real release. For this particular package, I found a bunch of problems with in via fuzzing and I turn it off in my own build.