Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing braces around for loop #197

Closed
Zenexer opened this issue Dec 15, 2020 · 1 comment
Closed

Missing braces around for loop #197

Zenexer opened this issue Dec 15, 2020 · 1 comment

Comments

@Zenexer
Copy link

Zenexer commented Dec 15, 2020

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]);

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]);
Zenexer added a commit to Zenexer/RPiPlay that referenced this issue Dec 15, 2020
@pallas
Copy link
Collaborator

pallas commented Dec 15, 2020

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.

@pallas pallas closed this as completed Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants