History

m4a: make sure to not seek in an infinite loop with broken files

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit 261e90c1 parent 86009121 file · +3 −1Browse files

Unified · Split

m4a.c+3−1
@@ -19,7 +19,7 @@ tagm4a(Tagctx *ctx) · 18 unmodified lines
1919 sz = beuint(d) - 4; /* already have 8 bytes */
2020
2121 for(;;){
22− if(ctx->seek(ctx, sz, 1) < 0)
22+ if(sz < 0 || ctx->seek(ctx, sz, 1) < 0)
2323 return -1;
2424 if(ctx->read(ctx, d, 4) != 4) /* size */
2525 break;
@@ -58,6 +58,8 @@ tagm4a(Tagctx *ctx) · 32 unmodified lines
5858 return -1;
5959 sz -= 8;
6060 skip = beuint(d) - 8;
61+ if(skip < 0)
62+ return -1;
6163
6264 if(memcmp(&d[4], "mp4a", 4) == 0){ /* audio */
6365 n = 6+2 + 2+4+2 + 2+2 + 2+2 + 4; /* read a bunch at once */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t