Skip to content

Commit

Permalink
opusinfo: Silence GCC 12 compiler warning
Browse files Browse the repository at this point in the history
src/opusinfo.c: In function 'check_xiph_comment':
src/opusinfo.c:297:32: warning: argument 1 range [18446744072098938880, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  297 |          data=(unsigned char *)malloc(data_sz*sizeof(*data));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Loading branch information
mark4o committed Nov 12, 2023
1 parent 7b92abb commit 98f3ddc
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/opusinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,13 @@ void check_xiph_comment(stream_processor *stream, int i, const char *comment,

for(j=0; j < sep-comment; j++) {
if(comment[j] < 0x20 || comment[j] > 0x7D) {
oi_warn(_("WARNING: Invalid comment fieldname in "
oi_warn(_("WARNING: Invalid comment tag in "
"comment %d (stream %d): \"%s\"\n"),
i, stream->num, comment);
broken = 1;
break;
return;
}
}

if(broken)
return;

val = (unsigned char *)comment;

j = sep-comment+1;
Expand Down Expand Up @@ -286,15 +282,15 @@ void check_xiph_comment(stream_processor *stream, int i, const char *comment,
}
len>>=2;
data_sz=3*len;
if(data_sz > 0) {
if(data_sz > 2) {
if(comment[comment_length - 1] == '=') {
data_sz--;
}
if(comment[comment_length - 2] == '=') {
data_sz--;
if(comment[comment_length - 2] == '=') {
data_sz--;
}
}
}
data=(unsigned char *)malloc(data_sz*sizeof(*data));
data=data_sz>0?(unsigned char *)malloc(data_sz*sizeof(*data)):NULL;
for (j = 0; j < len; j++) {
ogg_uint32_t value;
int k;
Expand Down

0 comments on commit 98f3ddc

Please sign in to comment.