You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "Mryange (via GitHub)" <gi...@apache.org> on 2023/04/21 03:16:25 UTC

[GitHub] [doris] Mryange commented on a diff in pull request #18872: [fix](planner) vdatetime_value.cpp:1585 Array access may overflow.

Mryange commented on code in PR #18872:
URL: https://github.com/apache/doris/pull/18872#discussion_r1173262552


##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -1580,10 +1580,10 @@ bool VecDateTimeValue::date_add_interval(const TimeInterval& interval) {
         // This will change month and year information, maybe date.
         int64_t months = _year * 12 + _month - 1 + sign * (12 * interval.year + interval.month);
         _year = months / 12;
-        if (_year > 9999) {
+        if (_year < MIN_YEAR || _year > MAX_YEAR) {
             return false;
         }
-        _month = (months % 12) + 1;
+        _month = ((_month + 11 + sign * interval.month + 12) % 12) + 1;

Review Comment:
   Is there a error case for me to test?



-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org