Skip to content

🐛 Crash searching a long diff #210

@jlawton

Description

@jlawton

delta --version: 0.1.1
git config core.pager: delta --dark

I have a 25MB diff that unfortunately I can't share. It's a mixture of various code, XML, PDFs, etc. I'm sorry if that leaves this a little lean on detail. My main lead is that the diff has a lot of inexact renames, but that could be a red herring.

Two bad behaviors happen with delta.

  1. I can git show and hit G to jump to the end, I only get to line 184,066, with the rest of the diff cut off. The same with git show | less, I get to 547,184.

  2. If I kick off a search that doesn't match instead, I get an out of bounds error with the following trace:

thread 'main' panicked at 'byte index 2 is out of bounds of `&`', src/libcore/str/mod.rs:2131:9
stack backtrace:
   0:        0x10732cac5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h30b85a1761190f28
   1:        0x1073431ce - core::fmt::write::h5b0722e6ee659e34
   2:        0x10732bce9 - std::io::Write::write_fmt::hf468289e762fa2f9
   3:        0x10731d86a - std::panicking::default_hook::{{closure}}::h836d46ca6b872224
   4:        0x10731d58f - std::panicking::default_hook::h2afcf1998cd93f8c
   5:        0x10731de4d - std::panicking::rust_panic_with_hook::he4f5d8b43533efd5
   6:        0x10731da12 - rust_begin_unwind
   7:        0x10734f32f - core::panicking::panic_fmt::h3559129da805eab4
   8:        0x10734f0ae - core::str::slice_error_fail::hd6f6d2e5a693e978
   9:        0x1071d84c4 - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}::h24851af3c1dab157
  10:        0x1071da39f - delta::parse::get_file_extension_from_diff_line::h02d721288dfd8178
  11:        0x1071cd157 - delta::delta::delta::hef7771a97efa631e
  12:        0x1071d67fe - delta::main::hfdd82967b734b176
  13:        0x1071d7505 - std::rt::lang_start::{{closure}}::h5d2da361401c3ca8
  14:        0x10731d928 - std::panicking::try::do_call::h29bd6a8b4eb65398
  15:        0x10733025b - __rust_maybe_catch_panic
  16:        0x107322389 - std::rt::lang_start_internal::h1cbb853ed77189ce
  17:        0x1071d74d9 - main

The same with git show | less spits out the following (on stderr, CTRL-L repaints without the lines) but then G does get to the end of the diff.

warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 4020 and retry the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions