• Zihao Lin's avatar
    Improve GETRANGE command behavior (#12272) · 6ceadfb5
    Zihao Lin authored
    
    
    Fixed the issue about GETRANGE and SUBSTR command
    return unexpected result caused by the `start` and `end` out of
    definition range of string.
    
    ---
    ## break change
    Before this PR, when negative `end` was out of range (i.e., end <
    -strlen), we would fix it to 0 to get the substring, which also resulted
    in the first character still being returned for this kind of out of
    range.
    After this PR, we ensure that `GETRANGE` returns an empty bulk when the
    negative end index is out of range.
    
    Closes #11738
    
    ---------
    Co-authored-by: default avatardebing.sun <debing.sun@redis.com>
    6ceadfb5
t_string.c 32 KB