mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Bug 1640475: Report OOM in initializeNamedCaptures r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D76956
This commit is contained in:
parent
7b6180750d
commit
f3489ed171
9
js/src/jit-test/tests/regexp/bug1640475.js
Normal file
9
js/src/jit-test/tests/regexp/bug1640475.js
Normal file
@ -0,0 +1,9 @@
|
||||
// |jit-test| skip-if: !('oomTest' in this)
|
||||
|
||||
var i = 0;
|
||||
oomTest(function() {
|
||||
for (var j = 0; j < 10; ++j) {
|
||||
var r = RegExp(`(?<_${(i++).toString(32)}>a)`);
|
||||
r.exec("a");
|
||||
}
|
||||
});
|
@ -1180,6 +1180,7 @@ bool RegExpShared::initializeNamedCaptures(JSContext* cx, HandleRegExpShared re,
|
||||
uint32_t arraySize = numNamedCaptures * sizeof(uint32_t);
|
||||
uint32_t* captureIndices = static_cast<uint32_t*>(js_malloc(arraySize));
|
||||
if (!captureIndices) {
|
||||
js::ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user