You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "cmcfarlen (via GitHub)" <gi...@apache.org> on 2025/10/18 21:08:14 UTC

[PR] asan: regression test assume null terminated strings [trafficserver]

cmcfarlen opened a new pull request, #12582:
URL: https://github.com/apache/trafficserver/pull/12582

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] asan: regression test assume null terminated strings [trafficserver]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12582:
URL: https://github.com/apache/trafficserver/pull/12582#discussion_r2443640514


##########
src/api/InkAPITest.cc:
##########
@@ -5216,11 +5224,8 @@ REGRESSION_TEST(SDK_API_TSMimeHdrField)(RegressionTest *test, int /* atype ATS_U
            lengthField1Value4 == static_cast<int>(strlen(field1Value4))) &&
           ((strncmp(field1Value5Get, field1Value5, lengthField1Value5) == 0) &&
            lengthField1Value5 == static_cast<int>(strlen(field1Value5))) &&
-          (strstr(field1ValueAllGet, field1Value1Get) == field1Value1Get) &&
-          (strstr(field1ValueAllGet, field1Value2Get) == field1Value2Get) &&
-          (strstr(field1ValueAllGet, field1Value3Get) == field1Value3Get) &&
-          (strstr(field1ValueAllGet, field1Value4Get) == field1Value4Get) &&
-          (strstr(field1ValueAllGet, field1Value5Get) == field1Value5Get)) {
+          (svall.find(sv1) != svall.npos) && (svall.find(sv2) != svall.npos) && (svall.find(sv3) != svall.npos) &&
+          (svall.find(sv4) != svall.npos) && (svall.find(sv5) != svall.npos)) {

Review Comment:
   The original code checked if each substring appeared at the start of the full string using pointer equality (`strstr(field1ValueAllGet, field1Value1Get) == field1Value1Get`). The new code only checks if substrings exist anywhere in the string using `find() != npos`, which changes the test semantics. To preserve the original behavior, use `svall.starts_with(sv1)` or check if `svall.find(sv1) == 0`.
   ```suggestion
             (svall.find(sv1) == 0) && (svall.find(sv2) == 0) && (svall.find(sv3) == 0) &&
             (svall.find(sv4) == 0) && (svall.find(sv5) == 0)) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] asan: regression test assume null terminated strings [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen merged PR #12582:
URL: https://github.com/apache/trafficserver/pull/12582


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] asan: regression test assume null terminated strings [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #12582:
URL: https://github.com/apache/trafficserver/pull/12582#issuecomment-3418875088

   [approve ci autest 1]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] asan: regression test assume null terminated strings [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #12582:
URL: https://github.com/apache/trafficserver/pull/12582#issuecomment-3418852617

   [approve ci autest 1]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org