h264bitstream icon indicating copy to clipboard operation
h264bitstream copied to clipboard

Missing braces in for loop

Open Zenexer opened this issue 2 years ago • 1 comments

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 avatar Mar 15 '22 15:03 Zenexer

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.

Zenexer avatar Mar 15 '22 15:03 Zenexer