Skip to content

Commit

Permalink
Merge pull request #541 from KhronosGroup/fix/endlessLoop
Browse files Browse the repository at this point in the history
Add range check for hdr parsing
  • Loading branch information
UX3D-kanzler authored Apr 26, 2024
2 parents 73ca73b + d52856a commit eda8bf6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/libs/hdrpng.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function loadHDR(buffer)
const d8 = buffer;
let format = undefined;
// read header.
while (!header.match(/\n\n[^\n]+\n/g)) header += String.fromCharCode(d8[pos++]);
while (!header.match(/\n\n[^\n]+\n/g) && pos < d8.length) header += String.fromCharCode(d8[pos++]);
// check format.
format = header.match(/FORMAT=(.*)$/m);
if (format.length < 2)
Expand Down

0 comments on commit eda8bf6

Please sign in to comment.