Skip to content

Commit 98f3ddc

Browse files
committed
opusinfo: Silence GCC 12 compiler warning
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)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 parent 7b92abb commit 98f3ddc

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/opusinfo.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,13 @@ void check_xiph_comment(stream_processor *stream, int i, const char *comment,
122122

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

133-
if(broken)
134-
return;
135-
136132
val = (unsigned char *)comment;
137133

138134
j = sep-comment+1;
@@ -286,15 +282,15 @@ void check_xiph_comment(stream_processor *stream, int i, const char *comment,
286282
}
287283
len>>=2;
288284
data_sz=3*len;
289-
if(data_sz > 0) {
285+
if(data_sz > 2) {
290286
if(comment[comment_length - 1] == '=') {
291287
data_sz--;
292-
}
293-
if(comment[comment_length - 2] == '=') {
294-
data_sz--;
288+
if(comment[comment_length - 2] == '=') {
289+
data_sz--;
290+
}
295291
}
296292
}
297-
data=(unsigned char *)malloc(data_sz*sizeof(*data));
293+
data=data_sz>0?(unsigned char *)malloc(data_sz*sizeof(*data)):NULL;
298294
for (j = 0; j < len; j++) {
299295
ogg_uint32_t value;
300296
int k;

0 commit comments

Comments
 (0)