-
Notifications
You must be signed in to change notification settings - Fork 149
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
SEGV on XrdOucString replace(...) method #1094
Comments
Adding valgrind output:
|
In case of string like "aaaa" and replacement "a" -> "xa" in following code snippet: xrootd/src/XrdOuc/XrdOucString.cc Lines 802 to 811 in 367f86f
after 4 iterations the algorithm replaces "aaaa" with "xaxaxaxa" and xrootd/src/XrdOuc/XrdOucString.cc Line 811 in 367f86f
substituting the variables with values: |
xrootd/src/XrdOuc/XrdOucString.cc
Line 733 in de93530
replace() method on some strings triggers "SEGV signal caused by a WRITE memory access".
For example:
XrdOucString good_s {"aaa"};
good_s.replace("a","xa"} // no problem
// But
XrdOucString bad_s {"aaaa"};
bad_s.replace("a","xa"} // SEGV on write
// Anyway
XrdOucString another_good_s {"abaa"};
another_good_s.replace("a","xa"} // no problem
Trying with a few other sample strings, it looks like there is a pattern with "faulty strings" being longer than 4 chars and with 2 equal starting characters, when the string to be replaced is a substring of the replacing string.
( Just an hint, it has not been rigorously proven though ).
The text was updated successfully, but these errors were encountered: