[BUG REPORT] Multiple panics found in different locations.
Author: xizheyinCreated Jul 5, 2023Updated Jul 10, 2023
Description
I have identified 20 bugs using my fuzz testing tool, which are panics occurring in different parts of the code. Many of these bugs may require relatively complex interactions, such as long dependency sequences, to be triggered. The majority of these issues are related to arithmetic overflow. I have uploaded the replay files and inputs here. Please review them and let me know if any modifications are necessary. Thank you very much.
version
xi-core-lib = "=0.3.0"Below are the corresponding error messages
bug1
thread 'main' panicked at 'attempt to subtract with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:299:21bug2
thread 'main' panicked at 'slice index starts at 1 but ends at 0',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/selection.rs:135:10bug3
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:267:30bug4
thread 'main' panicked at 'attempt to subtract with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/editor.rs:191:9bug5
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:111:21bug6
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:109:48bug7
thread 'main' panicked at 'attempt to subtract with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/selection.rs:186:44bug8
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:270:32bug9
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/selection.rs:71:33bug10
thread 'main' panicked at 'attempt to subtract with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/view.rs:327:23bug11
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:142:16bug12
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:144:45bug13
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:131:16bug14
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:233:29bug15
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:230:23bug16
thread 'main' panicked at 'attempt to subtract with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/selection.rs:154:47bug17
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:173:40bug18
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:183:45bug19
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:177:21bug20
thread 'main' panicked at 'attempt to add with overflow',
/home/yxz/.cargo/registry/src/github.com-1ecc6299db9ec823/xi-core-lib-0.3.0/src/line_cache_shadow.rs:156:24Source: xi-editor/xi-editor