mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-20 19:33:08 +09:00
[html parser] Check for integer overflow when computing new buffer sizes.
This commit is contained in:
parent
d86d1256bc
commit
5934c74a3f
7 changed files with 36 additions and 13 deletions
|
|
@ -7,6 +7,15 @@
|
|||
#include "jArray.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
|
||||
int32_t nsHtml5Portability::checkedAdd(int32_t a, int32_t b) {
|
||||
mozilla::CheckedInt<int32_t> sum(a);
|
||||
sum += b;
|
||||
MOZ_RELEASE_ASSERT(sum.isValid(),
|
||||
"HTML input too large for signed 32-bit integer.");
|
||||
return sum.value();
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue