julia
75c7c600 - Add a fast path for returning "" from repeat(str, 0) (#35579)

Commit
5 years ago
Add a fast path for returning "" from repeat(str, 0) (#35579) Currently the case where `r == 0` falls through the same logic as every other non-negative value of `r` (aside from 1). This works for signed integers. However, this does not work for unsigned integers: in the loop where we unsafely fill in the output string, we're looping from 0 to `r - 1`, which for unsigned integers wraps around and causes us to request the address of the output string at a location that is well beyond what was allocated. Fixes #35578. (cherry picked from commit 1dcb42f29caffc98ad0722577844ce5c54c5ba0c)
Author
Committer
Parents
Loading