diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-01-18 17:10:21 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-01-18 17:10:21 +0200 |
commit | bbd071f3d53b3a8169647f8594ce97ccdbc86f36 (patch) | |
tree | e72b5825d31766cb9a09c282b303818c4b9f7691 /indra/llcommon | |
parent | bee13995e42417c3e2b19b8f329eaec7528b1344 (diff) |
SL-14597 ensure that uris don't crash viewer
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lluriparser.cpp | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index c275b90120..015ff2d7c3 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -163,26 +163,37 @@ S32 LLUriParser::normalize() mNormalizedTmp = mTmpScheme; if (!mRes) { - mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); - - if (!mRes) - { - S32 chars_required; - mRes = uriToStringCharsRequiredA(&mUri, &chars_required); - - if (!mRes) - { - chars_required++; - std::vector<char> label_buf(chars_required); - mRes = uriToStringA(&label_buf[0], &mUri, chars_required, NULL); - - if (!mRes) - { - mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; - mTmpScheme = false; - } - } - } + // Uriparser is 3p software we can not directly fix. + // On winodws this probably requires SEH handling, but all + // crashes so far were on MAC in scope of uriNormalizeSyntaxExA. + try + { + mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); + + if (!mRes) + { + S32 chars_required; + mRes = uriToStringCharsRequiredA(&mUri, &chars_required); + + if (!mRes) + { + chars_required++; + std::vector<char> label_buf(chars_required); + mRes = uriToStringA(&label_buf[0], &mUri, chars_required, NULL); + + if (!mRes) + { + mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; + mTmpScheme = false; + } + } + } + } + catch (...) + { + // At this point mNormalizedUri should contain http+unmodified input string. + LL_WARNS() << "Uriparser crashed processing: " << mNormalizedUri << LL_ENDL; + } } if(mTmpScheme) |