Fix overflow conditions in prefetch plugin#8660
Conversation
1. Specify integer size limitations. 2. Specify underflow/overflow behavior. 3. Refactor and add unit tests for evaluate().
94b76e8 to
a37fd9d
Compare
plugins/prefetch/evaluate.h
Outdated
| #pragma once | ||
| #include "common.h" | ||
|
|
||
| String evaluate(const String &v); No newline at end of file |
There was a problem hiding this comment.
Thanks. Added an eol.
| subtracting integer numbers. | ||
| subtracting integer numbers. The operands will be treated as unsigned | ||
| 32-bit integers. Invalid numbers are treated as zeroes, and numbers | ||
| too large will be interpreted as 2^32-1. If subtraction results in |
There was a problem hiding this comment.
Did you mean 64 not 32?
Also have you tried https://restructuredtext.documatt.com/element/superscript.html ?
There was a problem hiding this comment.
I chose 32-bit operands and 64-bit results here so that addition doesn't ever overflow. That way there doesn't need to be a special rule for handling overflows when adding.
Thanks for pointing out the superscript element. I've changed the exponent to a superscript.
I'm testing using these rules: Compared to the example in the docs, I added |
|
Merging this for Mo Chen since he's not yet a committer. |
* Prefetch plugin: improve over/underflow handling 1. Specify integer size limitations. 2. Specify underflow/overflow behavior. 3. Refactor and add unit tests for evaluate(). * Use superscript for exponent * Add end-of-line to evaluate.h (cherry picked from commit bd15558)
|
Cherry-picked to v9.2.x |
* asf/9.2.x: Updated ChangeLog Fix parent_select optional scheme (apache#8831) Add `#pragma once` for PendingAction.h (apache#8846) Promote class PendingAction from HttpSM.h for use in other classes. (apache#8423) Fixes leak in SNIAction name globbing (apache#8827) Handle opentelemetry-cpp v1.3.0 upgrade for otel_tracer plugin (apache#8834) Fix overflow conditions in prefetch plugin (apache#8660) Remove incorrect comment from base64 functions (apache#8835) Add autest to cover updates to cache with alternates (apache#8779)
In the prefetch plugin:
This PR addresses #8569.