-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in lsbom #33
Comments
Why are you using |
Uh, sorry for never coming back here. I inferred from the original change that the essence still was to check for name to contain the exact string "Paths" or to start with "Paths".
Note that this change effectively isn't only faulting, but it inverts the logic of the test: as it is now true when the string "Paths" is not found in name (i.e. when strstr returns NULL). Under that assumption, rfind(.., 0) is the most efficient way to test for the string to start with "Paths", as find() would continue to search the rest of name, just to discard the result afterwards. |
I wonder what was the motivation for the change in the first place? |
Thank you for this great utility!
Unfortunately, commit 704739c introduced a segfault in lsbom, which is triggered verifying any Bom. Even the provided docker image fails to build.
I resolved the issue as follows:
Passing c_str() pointers to standard library string functions is problematic; the C++ reference says the pointer obtained from c_str() may be invalidated by passing a non-const reference to the string to any standard library function
The text was updated successfully, but these errors were encountered: