In case of string like "aaaa" and replacement "a" -> "xa" in following code snippet:
https://github.com/xrootd/xrootd/blob/367f86f21a3f232449096aec0c7646bfba9d049f/src/XrdOuc/XrdOucString.cc#L802-L811
after 4 iterations the algorithm replaces "aaaa" with "xaxaxaxa" and at = 0
and l1 = 1
(length of the to be replaced string) at that point we call:
https://github.com/xrootd/xrootd/blob/367f86f21a3f232449096aec0c7646bfba9d049f/src/XrdOuc/XrdOucString.cc#L811
substituting the variables with values: at = rfind("a",-1);
, in the context of rfind
the -1 constant has a special meaning (STR_NPOS
) -> search starts from end of string, hence although we are basically done the algorithm starts again scanning the whole string and as a result at some point the output buffer gets miscalculated at some point which results with a segv.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/xrootd/xrootd/issues/1094?email_source=notifications\u0026email_token=AA7NRDSQCQT7274JZPUF7YDQ6HF4DA5CNFSM4JTT4YG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJIBUMY#issuecomment-575674931",
"url": "https://github.com/xrootd/xrootd/issues/1094?email_source=notifications\u0026email_token=AA7NRDSQCQT7274JZPUF7YDQ6HF4DA5CNFSM4JTT4YG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJIBUMY#issuecomment-575674931",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1