1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

LibRegex: Fix assertion when parsing '(?'

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28186&q=label%3AProj-serenity
This commit is contained in:
AnotherTest 2020-12-03 12:28:47 +03:30 committed by Andreas Kling
parent 4fe987ba00
commit c1c5225b72
2 changed files with 4 additions and 0 deletions

View file

@ -64,6 +64,9 @@ ALWAYS_INLINE char Lexer::peek(size_t offset) const
void Lexer::back(size_t offset)
{
if (offset == m_position + 1)
offset = m_position; // 'position == 0' occurs twice.
ASSERT(offset <= m_position);
if (!offset)
return;