Skip to content

Fix nullptr deref in yasm_expr__copy_except#241

Merged
PeterJohnson merged 1 commit intoyasm:masterfrom
cla7aye15I4nd:dev
Sep 22, 2023
Merged

Fix nullptr deref in yasm_expr__copy_except#241
PeterJohnson merged 1 commit intoyasm:masterfrom
cla7aye15I4nd:dev

Conversation

@cla7aye15I4nd
Copy link
Contributor

In yasm/modules/parsers/nasm/nasm-parse.c:1562, the function nasm_parser_directive passes parser_nasm->absstart to yasm_expr_copy. However, the return value of yasm_vp_expr may be null, and yasm_expr_copy does not check for it.

parser_nasm->absstart = yasm_vp_expr(vp, p_object->symtab, line);
parser_nasm->abspos = yasm_expr_copy(parser_nasm->absstart);

Here is a PoC to trigger it:

echo ZGIgaO4QAHhdCmwAgAAAXQpsYWJlbDE3ClthYjE6ClthYnNvbHV0ZSdsYWJlbDFdCng6 | base64 -d > poc.asm
./yasm poc.asm

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.

2 participants