mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 22:03:49 +02:00
Merge pull request #44 from frw/patch-1
fix: check string for null terminators
This commit is contained in:
@@ -499,7 +499,13 @@ export class EBMLReader {
|
|||||||
const { view, offset } = this.reader.getViewAndOffset(this.pos, this.pos + length);
|
const { view, offset } = this.reader.getViewAndOffset(this.pos, this.pos + length);
|
||||||
this.pos += length;
|
this.pos += length;
|
||||||
|
|
||||||
return String.fromCharCode(...new Uint8Array(view.buffer, offset, length));
|
// Actual string length might be shorter due to null terminators
|
||||||
|
let strLength = 0;
|
||||||
|
while (strLength < length && view.getUint8(offset + strLength) !== 0) {
|
||||||
|
strLength += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.fromCharCode(...new Uint8Array(view.buffer, offset, strLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
readElementId() {
|
readElementId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user