StanfordPL / x64asm

x86-64 assembler library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assembler segfaults because it doesn't reserve enough memory

Detry322 opened this issue · comments

I don't have a minimal bug reproducing program, but when doing something of the form:

x64asm::Function function;
x64asm::Assembler assembler;

assembler.start(function);

// ... lots of assembly here, mov for me seemed to trigger the segfault ...
assembler.mov(r10, Imm64{10L});

assembler.finish();

cout << function << endl;

Given enough instructions, this program will segfault. Maybe this is because the implementations used to write instructions don't call the reserve method?

@eschkufz maybe worth it to add to the documentation? we can do a PR

Yeah, we'd be happy to accept a PR to add this to the documentation!