Wilfred / difftastic

a structural diff that understands syntax 🟥🟩
https://difftastic.wilfred.me.uk/
MIT License
21.18k stars 347 forks source link

crash when diffing files #742

Closed iacore closed 4 months ago

iacore commented 4 months ago

a.txt b.txt

❯ difft a.txt b.txt
b.txt --- Text
 1 zset(c, a): 0.001893056 µs (152 bits)              1 zset(c, a): 0.000728929 µs (152 bits)
 2 zseti(c, 1000000000LL): 0.001084418 µs (152 bits)  2 zseti(c, 1000000000LL): 0.000421660 µs (152 bits)
 3 zsetu(c, 1000000000ULL): 0.000935439 µs (152 bits  3 zsetu(c, 1000000000ULL): 0.000503108 µs (152 bits
 . )                                                  . )
 4 zneg(c, a): 0.001831428 µs (152 bits)              4 zneg(c, a): 0.000826370 µs (152 bits)
 5 zneg(a, a): 0.000000007 µs (152 bits)              5 zneg(a, a): 0.000000003 µs (152 bits)
 6 zabs(c, a): 0.001880756 µs (152 bits)              6 zabs(c, a): 0.000827791 µs (152 bits)
 7 zabs(a, a): 0.000134203 µs (152 bits)              7 zabs(a, a): 0.000000003 µs (152 bits)
 8 zadd_unsigned(c, a, b): 0.007325051 µs (152 bits)  8 zadd_unsigned(c, a, b): 0.003500850 µs (152 bits)
 9 zsub_unsigned(c, a, b): 0.007726867 µs (152 bits)  9 zsub_unsigned(c, a, b): 0.003784255 µs (152 bits)
10 zadd(c, a, b): 0.003592278 µs (152 bits)          10 zadd(c, a, b): 0.004160308 µs (152 bits)
11 zsub(c, a, b): 0.003855403 µs (152 bits)          11 zsub(c, a, b): 0.004447759 µs (152 bits)
12 zand(c, a, b): 0.002830254 µs (152 bits)          12 zand(c, a, b): 0.001903593 µs (152 bits)
13 zor(c, a, b): 0.003636029 µs (152 bits)           13 zor(c, a, b): 0.003195840 µs (152 bits)
14 zxor(c, a, b): 0.004130534 µs (152 bits)          14 zxor(c, a, b): 0.003487263 µs (152 bits)
15 znot(c, a): 0.015524344 µs (152 bits)             15 znot(c, a): 0.001619537 µs (152 bits)
16 zeven(a): 0.000000006 µs (152 bits)               16 zeven(a): 0.000000016 µs (152 bits)
17 zodd(a): 0.000000016 µs (152 bits)                17 zodd(a): 0.000000013 µs (152 bits)
18 zeven_nonzero(a): 0.000000003 µs (152 bits)       18 zeven_nonzero(a): 0.000000004 µs (152 bits)
19 zodd_nonzero(a): 0.000000004 µs (152 bits)        19 zodd_nonzero(a): 0.000000012 µs (152 bits)
20 zzero(a): 0.000000017 µs (152 bits)               20 zzero(a): 0.000000018 µs (152 bits)
21 zsignum(a): 0.000000016 µs (152 bits)             21 zsignum(a): 0.000000016 µs (152 bits)
22 zbits(a): 0.004137008 µs (152 bits)               22 zbits(a): 0.000000020 µs (152 bits)
23 zlsb(a): 0.001195408 µs (152 bits)                23 zlsb(a): 0.000000017 µs (152 bits)
24 zswap(a, b): 0.001012669 µs (152 bits)            24 zswap(a, b): 0.000268515 µs (152 bits)
25 zlsh(c, a, 76): 0.003870848 µs (152 bits)         25 zlsh(c, a, 76): 0.002214447 µs (152 bits)
26 zrsh(c, a, 76): 0.003228138 µs (152 bits)         26 zrsh(c, a, 76): 0.002521527 µs (152 bits)
27 ztrunc(c, a, 76): 0.002677125 µs (152 bits)       27 ztrunc(c, a, 76): 0.001663636 µs (152 bits)
28 ztrunc(c, c, 76): 0.001926892 µs (152 bits)       28 ztrunc(c, c, 76): 0.001342469 µs (152 bits)
29 zsplit(c, d, a, 76): 0.005755886 µs (152 bits)    29 zsplit(c, d, a, 76): 0.004290662 µs (152 bits)
30 zcmpmag(a, b): 0.001503018 µs (152 bits)          30 zcmpmag(a, b): 0.000412722 µs (152 bits)
31 zcmp(a, b): 0.001820396 µs (152 bits)             31 zcmp(a, b): 0.000425991 µs (152 bits)
32 zcmpi(a, 1000000000LL): 0.001740845 µs (152 bits) 32 zcmpi(a, 1000000000LL): 0.000000045 µs (152 bits)
33 zcmpi(a, -1000000000LL): 0.001864348 µs (152 bits 33 zcmpi(a, -1000000000LL): 0.000000005 µs (152 bits
.. )                                                 .. )
34 zcmpu(a, 1000000000ULL): 0.001733734 µs (152 bits 34 zcmpu(a, 1000000000ULL): 0.000000006 µs (152 bits
.. )                                                 .. )
35 zbset(c, a, 76, 1): 0.003055663 µs (152 bits)     35 zbset(c, a, 76, 1): 0.001472734 µs (152 bits)
36 zbset(a, a, 76, 1): 0.001357719 µs (152 bits)     36 zbset(a, a, 76, 1): 0.000722535 µs (152 bits)
37 zbset(c, a, 76, 0): 0.003236893 µs (152 bits)     37 zbset(c, a, 76, 0): 0.001607233 µs (152 bits)
38 zbset(c, c, 76, 0): 0.001492728 µs (152 bits)     38 zbset(c, c, 76, 0): 0.000663538 µs (152 bits)
39 zbset(c, a, 76, -1): 0.003229420 µs (152 bits)    39 zbset(c, a, 76, -1): 0.001865389 µs (152 bits)
40 zbset(a, a, 76, -1): 0.001508762 µs (152 bits)    40 zbset(a, a, 76, -1): 0.000659747 µs (152 bits)
41 zbtest(a, 76): 0.001091489 µs (152 bits)          41 zbtest(a, 76): 0.000000007 µs (152 bits)
42 zgcd(c, a, b): 0.000202085 ms (152 bits)          42 zgcd(c, a, b): 0.000498672 ms (152 bits)
43 zmul(c, a, b): 0.000010856 ms (152 bits)          43 zmul(c, a, b): 0.000786643 ms (152 bits)
44 zmul(c, a, a): 0.000017752 ms (152 bits)          44 zmul(c, a, a): 0.000784568 ms (152 bits)
45 zsqr(c, a): 0.000015858 ms (152 bits)             45 zsqr(c, a): 0.000394040 ms (152 bits)
46 zmodmul(c, a, b, d): 0.000044086 ms (152 bits)    46 zmodmul(c, a, b, d): 0.001834028 ms (152 bits)
47 zmodmul(c, a, a, d): 0.000053030 ms (152 bits)    47 zmodmul(c, a, a, d): 0.001885421 ms (152 bits)
48 zmodsqr(c, a, d): 0.000052615 ms (152 bits)       48 zmodsqr(c, a, d): 0.001336458 ms (152 bits)
49 zmodmul(c, a, b, tiny): 0.000027824 ms (152 bits) 49 zmodmul(c, a, b, tiny): 0.002362907 ms (152 bits)
50 zmodmul(c, a, a, tiny): 0.000034437 ms (152 bits) 50 zmodmul(c, a, a, tiny): 0.002591830 ms (152 bits)
51 zmodsqr(c, a, tiny): 0.000034727 ms (152 bits)    51 zmodsqr(c, a, tiny): 0.001963912 ms (152 bits)
52 zpow(c, a, d): 0.000145729 ms (152 bits)          52 zpow(c, a, d): 0.043580311 ms (152 bits)
53 zpowu(c, a, 12): 0.000144397 ms (152 bits)        53 zpowu(c, a, 12): 0.024394359 ms (152 bits)
54 zmodpow(c, a, d, b): 0.000169672 ms (152 bits)    54 zmodpow(c, a, d, b): 0.008675147 ms (152 bits)
55 zmodpowu(c, a, 12, b): 0.000126905 ms (152 bits)  55 zmodpowu(c, a, 12, b): 0.006665461 ms (152 bits)
56 zsets(c, "549546823459296402344728036844288438100 56 zsets(c, "549546823459296402344728036844288438100
.. 0481887"): 0.000036615 ms (152 bits)              .. 0481887"): 0.000308036 ms (152 bits)
57 zstr_length(a, 10): 0.000001307 ms (152 bits)     57 zstr_length(a, 10): 0.000710278 ms (152 bits)
58 zstr(a, buf, 0): 0.000047761 ms (152 bits)        58 zstr(a, buf, 0): 0.000782872 ms (152 bits)
59 zstr(a, buf, sizeof(buf) - 1): 0.000047291 ms (15 59 zstr(a, buf, sizeof(buf) - 1): 0.000764003 ms (15
.. 2 bits)                                           .. 2 bits)
60 zrand(c, DEFAULT_RANDOM, QUASIUNIFORM, a): 0.0000 60 zrand(c, DEFAULT_RANDOM, QUASIUNIFORM, a): 0.0010
.. 32959 ms (152 bits)                               .. 14868 ms (152 bits)
61 zrand(c, DEFAULT_RANDOM, UNIFORM, a): 0.000010788 61 zrand(c, DEFAULT_RANDOM, UNIFORM, a): 0.000070016
..  ms (152 bits)                                    ..  ms (152 bits)
62 zrand(c, DEFAULT_RANDOM, MODUNIFORM, a): 0.000015 62 zrand(c, DEFAULT_RANDOM, MODUNIFORM, a): 0.000059
.. 209 ms (152 bits)                                 .. 704 ms (152 bits)
63 zptest(d, a, 5): 0.000007732 ms (152 bits)        63 zptest(d, a, 5): 0.481094384 ms (152 bits)
64 zsave(a, buf): 0.037003752 µs (152 bits)          64 zsave(a, buf): 0.001759813 µs (152 bits)
65 zload(a, buf): 0.036181547 µs (152 bits)          65 zload(a, buf): 0.001128695 µs (152 bits)
66 zdiv(c, a, b): 0.017129641 µs (152 bits)          66 zdiv(c, a, b): 0.015511342 µs (152 bits)
67 zmod(c, a, b): 0.027846331 µs (152 bits)          67 zmod(c, a, b): 0.015972925 µs (152 bits)
68 zdivmod(c, d, a, b): 0.027697695 µs (152 bits)    68 zdivmod(c, d, a, b): 0.015239669 µs (152 bits)
69 zdiv(c, a, tiny): 0.000013063 ms (152 bits)       69 zdiv(c, a, tiny): 0.000772387 ms (152 bits)
70 zmod(c, a, tiny): 0.000013026 ms (152 bits)       70 zmod(c, a, tiny): 0.000750643 ms (152 bits)
71 zdivmod(c, d, a, tiny): 0.000013236 ms (152 bits) 71 zdivmod(c, d, a, tiny): 0.000755069 ms (152 bits)
thread 'main' panicked at src/display/side_by_side.rs:528:34:
index out of bounds: the len is 71 but the index is 71
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
elpres commented 4 months ago

Was just about to submit the same issue. Sorry, can’t provide the files, but the location of the panic is slightly different, probably due to it being an older version:

thread 'main' panicked at src/display/side_by_side.rs:519:34:
index out of bounds: the len is 524 but the index is 524
stack backtrace:
   0:     0x5ed85d272aa0 - <unknown>
   1:     0x5ed85d028f83 - <unknown>
   2:     0x5ed85d26d683 - <unknown>
   3:     0x5ed85d272850 - <unknown>
   4:     0x5ed85d2741c7 - <unknown>
   5:     0x5ed85d273ef4 - <unknown>
   6:     0x5ed85d2746d9 - <unknown>
   7:     0x5ed85d2745d6 - <unknown>
   8:     0x5ed85d272f99 - <unknown>
   9:     0x5ed85d274337 - <unknown>
  10:     0x5ed85cf7c536 - <unknown>
  11:     0x5ed85cf7c6e7 - <unknown>
  12:     0x5ed85d067d2d - <unknown>
  13:     0x5ed85d05f503 - <unknown>
  14:     0x5ed85d05a445 - <unknown>
  15:     0x5ed85d0854d6 - <unknown>
  16:     0x5ed85d0b1ffc - <unknown>
  17:     0x5ed85d265507 - <unknown>
  18:     0x5ed85d05f924 - <unknown>
  19:     0x771c8554ec88 - <unknown>
  20:     0x771c8554ed4c - __libc_start_main
  21:     0x5ed85cf9ec55 - <unknown>
  22:                0x0 - <unknown>

The used version is the latest one available from the Arch repositories:

$ difft --version
Difftastic 0.58.0 (0c9277108 2024-05-10, built with rustc 1.78.0)