Skip to content

Buffer overrun in Lexer with string literal longer than 4096 characters #316

@andreasabel

Description

@andreasabel

The generated lexer uses a fixed buffer that can overrun when lexing a long string literal:

"void YY_BUFFER_APPEND(char *s)",
"{",
" strcat(YY_PARSED_STRING, s); /* Do something better here! */",
"}",

(The authors were probably aware of the problem but did not care to fix it.)
Currently the length is fixed to 4096 characters, a longer string (5000 characters) overruns the buffer, leading e.g. to a crash (C) or a parse failure (C++).
This affects the C and C++ backends.

Metadata

Metadata

Assignees

Labels

CC++buglexerConcerning the generated lexer

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions