Skip to content

Commit 03207d0

Browse files
committed
Fix UB in add-debug libelfin library when calling front() on an empty string
Bug found in SWEB by https://github.com/Ferdi265 Open pull request on the upstream project that's been ignored so far... aclements/libelfin#63
1 parent 60ac14d commit 03207d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

utils/add-debug/dwarf/cursor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ cursor::string(std::string &out)
8686
size_t size;
8787
const char *p = this->cstr(&size);
8888
out.resize(size);
89-
memmove(&out.front(), p, size);
89+
if (size) memmove(&out.front(), p, size);
9090
}
9191

9292
const char *

0 commit comments

Comments
 (0)