mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Add non-PRODUCTION/TESTING overflow assert
s to various string helper-functions (issue 6759)
This commit is contained in:
parent
d644b66c72
commit
273d8cb746
6 changed files with 52 additions and 4 deletions
|
@ -588,6 +588,15 @@ function arraysToBytes(arr) {
|
|||
}
|
||||
|
||||
function string32(value) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
assert(
|
||||
typeof value === "number" && Math.abs(value) < 2 ** 32,
|
||||
`string32: Unexpected input "${value}".`
|
||||
);
|
||||
}
|
||||
return String.fromCharCode(
|
||||
(value >> 24) & 0xff,
|
||||
(value >> 16) & 0xff,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue