mikeV02 opened a new issue #8569:
URL: https://github.com/apache/trafficserver/issues/8569
Hello,
I was configuring the prefetch plugin to use for HLS caching hit
improvements, and captured the required patterns with regex and added the next
segments to download according to matches on our HLS manifest files. However,
one of these patters, uses numbering higher than the max signed 32-bit integer,
thus I saw it was overflowing and wrapping back into the negative integers.
Looking at the code, I see the overflow occurs on the function "**evaluate**"
of the _plugins/prefetch/plugin.cc_ file. Specifically on the following segment
of code:
```
if (String::npos == pos) {
result = getValue(stmt);
} else {
unsigned a = getValue(stmt.substr(0, pos));
unsigned b = getValue(stmt.substr(pos + 1));
if ('+' == stmt[pos]) {
result = a + b;
} else {
result = a - b;
}
}
std::ostringstream convert;
convert << std::setw(len) << std::setfill('0') << result;
PrefetchDebug("evaluation of '%s' resulted in '%s'", v.c_str(),
convert.str().c_str());
return convert.str();
```
For example, I am trying to add 2207264608520000 + 60060000. I tried
striping the four 0s at the end from the pattern, but the resulting number is
still greater than the max signed 32-bit integer.
I will try recompiling using long instead of int for the result, a and b
variables, but I am not sure if the **getValue** function may impact as well.
Sincerely!
Mike
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]