History

correctly treat unknown data size and invalid elements in mcfs itself

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 4f2bb7a1 parent a23fcf01 file · +9 −4Browse files

Unified · Split

matroska.c+9−4
@@ -220,6 +220,8 @@ matroskarun(Biobuf *f) · 219 unmodified lines
220220 werrstr("invalid ebml: %r at %#llx (size %lld)", off, sz);
221221 goto err;
222222 }
223+ if(el.type < 0)
224+ continue;
223225 if(n == 0) /* eof */
224226 break;
225227 left -= n;
@@ -231,7 +233,8 @@ matroskarun(Biobuf *f) · 5 unmodified lines
231233 }
232234 isebml++;
233235 }else if(el.id == ESegment){
234− left = sz;
236+ if(sz > 0)
237+ left = sz;
235238 if(isebml != 1){
236239 werrstr("invalid ebml");
237240 goto err;
@@ -439,9 +442,11 @@ matroskarun(Biobuf *f) · 201 unmodified lines
439442 getstring(ELanguage, e.lang)
440443 }
441444
442− if(Bseek(f, sz, 1) < 0)
443− return -1;
444− left -= sz;
445+ if(sz > 0){
446+ if(Bseek(f, sz, 1) < 0)
447+ return -1;
448+ left -= sz;
449+ }
445450 }
446451
447452 if(isebml == 2 && left == 0){

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