Modifed file pointer is not reset when _identify function in elffile.py raises exception
notgriffin opened this issue · comments
There is a case where the _identify function in elffile.py raises an exception, leaving the file pointer at 4.
pyelftools/elftools/elf/elffile.py
Lines 567 to 569 in 8a74c8f
When this code is used with a shared file pointer and code that assumes the file pointer will be 0 a code path like when trying to create an ELFFile object, it can cause issues when the ending file pointer is not 0. On an exception, the file pointer should be reset to 0 and the exception reraised.