aizvorski / h264bitstream

A complete set of functions to read and write H.264 video bitstreams, in particular to examine or modify headers.
GNU Lesser General Public License v2.1
732 stars 238 forks source link

Missing braces in for loop #45

Closed Zenexer closed 11 months ago

Zenexer commented 2 years ago

https://github.com/aizvorski/h264bitstream/blob/34f3c58afa3c47b6cf0a49308a68cbf89c5e0bff/h264_sei.c#L687

See:

https://github.com/FD-/RPiPlay/issues/197

https://github.com/FD-/RPiPlay/pull/198

Zenexer commented 2 years ago

Since this for loop lacks braces, it implicitly becomes:

for ( i = 0; i < s->payloadSize; i++ ) {
    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]); 

Note that only the first statement is looped. That's most likely not what was intended.