https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <[email protected]>:

https://gcc.gnu.org/g:4426e08a4fd0d35643d16a14c9e9b81488823a23

commit r17-2536-g4426e08a4fd0d35643d16a14c9e9b81488823a23
Author: Tomasz KamiÅski <[email protected]>
Date:   Fri Jul 17 13:21:39 2026 +0200

    libstdc++: Prevent overflow in find_active_rule to_local conversion.
[PR116110]

    As when member of Transitions::Entries that do not correspond
    to rule activation (rule is empty) is either minimum or maximum
    value of sys_seconds, adjusting it to std_offset lead to overflow
    (and UB). In practice this caused next.when to have very low value,
    and thus considered to be active rule. The to_local conversion now
    return local_seconds constucted directly from time_since_epoch
    (i.e. minimum and maximum).

    In consequence above, the save was still not applied for zones
    that specified UNTIL after firing of last rule, that also have
    non zero save (e.g. Asia/Bishkek 2005 transition).

    libstdc++-v3/ChangeLog:

            PR libstdc++/116110
            * src/c++20/tzdb.cc (find_active_rule::to_local): Do not
            modify min/max values for rules.
            * testsuite/std/time/time_zone/wall_cascade.cc: Add test
            for last_transition.

    Reviewed-by: Jonathan Wakely <[email protected]>
    Signed-off-by: Tomasz KamiÅski <[email protected]>

Reply via email to