aclements / libelfin

C++11 ELF/DWARF parser
MIT License
317 stars 99 forks source link

Add guard for arguments.size() == 0 to evaluate #26

Closed goldsborough closed 6 years ago

goldsborough commented 6 years ago

I ran into a segfault when calling dwarf::expr::evaluate. I took a look at the code and the issue seemed to be a fairly straightforward in that when arguments is empty, end() == begin() and so end() - 1 is out of bounds. I believe using an iterator pointing before begin() is UB. I imagine we have different implementations on our systems so it didn't trigger before. Anyway, fix is simple.