#1347·xi-editor

[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:21

bug2

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:10

bug3

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:30

bug4

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:9

bug5

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:21

bug6

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:48

bug7

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:44

bug8

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:32

bug9

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:33

bug10

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:23

bug11

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:16

bug12

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:45

bug13

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:16

bug14

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:29

bug15

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:23

bug16

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:47

bug17

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:40

bug18

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:45

bug19

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:21

bug20

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:24