Skip to content

Fix signed char indexing in lexer punctuation table - #25

Open
bobmoser76 wants to merge 1 commit into
themuffinator:mainfrom
bobmoser76:fix-signed-punctuation-index
Open

Fix signed char indexing in lexer punctuation table#25
bobmoser76 wants to merge 1 commit into
themuffinator:mainfrom
bobmoser76:fix-signed-punctuation-index

Conversation

@bobmoser76

Copy link
Copy Markdown

Fixes #24

Punctuation bytes >= 0x80 can become negative when read through signed char. Casting that value directly to unsigned int produces an out-of-range index for the 256-entry punctuation table.

This changes the three punctuation-table accesses in idLexer::CreatePunctuationTable() to cast through unsigned char instead.

Tested on CachyOS x86_64 with GCC 16.2.1. Before the change, OpenPREY consistently crashed at Lexer.cpp:550 during declaration initialization. After the change, PREY launches successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux SIGSEGV in idLexer::CreatePunctuationTable caused by signed char indexing

1 participant