[Bug 19826] New: ObjectContainerBSDArchive::Object::Extract() crashes if extracted file name is exactly 16 characters long

Bug ID 19826
Summary ObjectContainerBSDArchive::Object::Extract() crashes if extracted file name is exactly 16 characters long
Product lldb
Version unspecified
Hardware All
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter michaelwoerister@posteo.net
Classification Unclassified

The method ObjectContainerBSDArchive::Object::Extract() in 
source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
crashes if the file name extracted from the header is exactly 16 bytes long.
The error is caused by the following piece of code:

// Strip off any spaces (if the object file name contains spaces it
// will use the extended format above).
str.erase (str.find(' '));
ar_name.SetCString(str.c_str());

The str.find(' ') call returns npos in this case (because there are no padding
spaces) which causes str.erase() to throw an exception, crashing LLDB.

labath@google.com changed bug 19826

What | Removed | Added |

  • | - | - |
    Status | NEW | RESOLVED |
    CC | | labath@google.com |
    Resolution | — | FIXED |

Comment # 1 on bug 19826 from labath@google.com

It seems that file has a check for string::npos now.