ref: 4f2bb7a70bc730f9cd5890a8bd93c8652f2a8c1a
parent: a23fcf0c859ce06d348dc7015935b950f2d85c49
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Feb 5 07:43:07 EST 2021
correctly treat unknown data size and invalid elements in mcfs itself
--- a/matroska.c
+++ b/matroska.c
@@ -220,6 +220,8 @@
werrstr("invalid ebml: %r at %#llx (size %lld)", off, sz);
goto err;
}
+ if(el.type < 0)
+ continue;
if(n == 0) /* eof */
break;
left -= n;
@@ -231,7 +233,8 @@
}
isebml++;
}else if(el.id == ESegment){
- left = sz;
+ if(sz > 0)
+ left = sz;
if(isebml != 1){
werrstr("invalid ebml");
goto err;
@@ -439,9 +442,11 @@
getstring(ELanguage, e.lang)
}
- if(Bseek(f, sz, 1) < 0)
- return -1;
- left -= sz;
+ if(sz > 0){
+ if(Bseek(f, sz, 1) < 0)
+ return -1;
+ left -= sz;
+ }
}
if(isebml == 2 && left == 0){