mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-29 02:17:47 +00:00
Fix array-bounds-exceeded error
We didn't consider empty base/target strings and accessed the ith element unconditionally. We now check to make sure `i` is in range.
This commit is contained in:
@@ -349,7 +349,7 @@ _get_common_path_len :: proc(base, target: string) -> int {
|
||||
end := min(len(base), len(target))
|
||||
for j in 0..=end {
|
||||
if j == end || _is_path_separator(base[j]) {
|
||||
if _is_path_separator(base[i]) && _is_path_separator(target[i]) {
|
||||
if i < end && _is_path_separator(base[i]) && _is_path_separator(target[i]) {
|
||||
i += 1
|
||||
}
|
||||
if strings.equal_fold(base[i:j], target[i:j]) {
|
||||
|
||||
Reference in New Issue
Block a user