mindeng / nom-exif

Exif/metadata parsing library written in pure Rust, both image (jpeg/heif/heic/jpg/tiff/raf etc.) and video/audio (mov/mp4/3gp/webm/mkv/mka, etc.) files are supported.
https://crates.io/crates/nom-exif
MIT License
47 stars 7 forks source link

Panic when checking ramdisk file #1

Closed qarmin closed 8 months ago

qarmin commented 8 months ago
    for i in WalkDir::new("/home/rafal/").into_iter().flatten() {
        println!("{}", i.path().display());
        let file_reader = std::fs::File::open(i.path()).unwrap();
        let res = nom_exif::parse_jpeg_exif(file_reader);
        let file_reader = std::fs::File::open(i.path()).unwrap();
        let res2 = nom_exif::parse_heif_exif(file_reader);
        println!("{} {}", res.is_ok(), res2.is_ok());
    }
thread 'main' panicked at /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nom-exif-1.0.0/src/bbox.rs:192:25:
range start index 35736592 out of range for slice of length 4088
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::slice::index::slice_start_index_len_fail_rt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:52:5
   3: core::slice::index::slice_start_index_len_fail
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:40:9
   4: <core::ops::range::RangeFrom<usize> as core::slice::index::SliceIndex<[T]>>::index
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:480:13
   5: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:18:9
   6: nom_exif::bbox::travel_header
             at /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nom-exif-1.0.0/src/bbox.rs:192:25
   7: nom_exif::bbox::get_ftyp
             at /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nom-exif-1.0.0/src/bbox.rs:279:28
   8: nom_exif::heif::parse_heif_exif
             at /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nom-exif-1.0.0/src/heif.rs:65:22
   9: untitled::main
             at ./src/main.rs:10:20
  10: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5

ramdisk.img.zip

mindeng commented 8 months ago

Thank you for your feedback!

I have released version 1.0.1 to fix this issue.

If you encounter any other problems, please feel free to let me know. Thank you!