whitfin / runiq

An efficient way to filter duplicate lines from input, à la uniq.
MIT License
205 stars 23 forks source link

Index out of bounds #5

Closed pjox closed 4 years ago

pjox commented 4 years ago

Hello,

I downloaded runiq's code and compiled myself for mac, and I'm getting the following panic:

thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 18446744073709551615', /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/slice/mod.rs:2715:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

When running runiq on the following text:

Montrer les messages depuis: Tous les messages1 Jour7 Jours2 Semaines1 Mois3 Mois6 Mois1 An Le plus ancien en premierLe plus récent en premier
Sauter vers: Sélectionner un forum----------------==Réglement== Règlement du forum==Général== Présentez-Vous Demandes de skin Administratif Demande de Partenariat Boite a Idées pour le Forum==téléchargements GTS== camions scania vovlo Daf Man Renault Mercedes-benz Iveco Camions tandem Autres camion Remorques Frigo Container Plateau bachée Citerne Benne autres remorque Maps Mods aide==Partie photo== Photo de ETS Photo de GTS Photo de ET Photo de UK Photo d'autre jeux==Discussion== Discussion de ETS/GTS... Espace Blabla==Aide== Demande d'aide Demande de TutoriauxPartie GTA San Andreas GTA Modding Les Projets de Nos Membres Constructions BrianK Disscussions Diverses sur Tous Les Grand Theft Auto Off-Topic--Autres
Index | forum gratuit | Forum gratuit d’entraide | Annuaire des forums gratuits | Signaler une violation | Conditions générales d'utilisation

Les lois concernant l'utilisation d'un logiciel varient d'un pays à l'autre. Nous n'encourageons pas l'utilisation de ce logiciel s'il est en violation avec l'une de ces lois.

Blog hébergé par CanalBlog | Plan du site | Blog Cuisine et Gastronomie créé le 07/05/2006 | Contacter l'auteur | Signaler un abus

telecharger cv en ligne gratuit a word mettre mon gratuitement telechargement,telecharger modele cv en ligne mettre mon pole emploi gratuitement,format word comment mettre mon cv en ligne sur pole emploi indeed,faire un cv en ligne et le telecharger gratuitement gratuit mettre mon pole emploi,mettre mon cv en ligne sur pole emploi word indeed ou,mettre mon cv en ligne sur indeed comment pole emploi telecharger word,a ement telecharger cv en ligne gratuit telechargement mettre mon pole emploi,telecharger mon cv en ligne word curriculum vitae mettre pole emploi modele,mettre mon cv en ligne sur pole emploi telecharger comment a format word,mettre mon cv en ligne gratuitement web comment sur pole emploi.

Vous êtes à : Accueil > Label > Galerie des sites Web labellisés - Aucune correspondance pour ces critères

The problem disappears if I remove the newlines. Also the problem is not present if I use runiq via rust install runiq.

I want to download the code, because I want to introduce a simple modification to ignore empty lines, so that I can preserve new lines between paragraphs. Thus the vanilla version of runiq won't work for me.

Thank you in advance for your help.

pjox commented 4 years ago

This is the backtrace by the way (sorry I forgot to add it on my last message):

thread 'main' panicked at 'attempt to subtract with overflow', /Users/portizsu/.cargo/registry/src/github.com-1ecc6299db9ec823/bytelines-2.1.0/src/lib.rs:124:36
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::panicking::panic
             at src/libcore/panicking.rs:49
  11: bytelines::ByteLines<B>::next
             at /Users/portizsu/.cargo/registry/src/github.com-1ecc6299db9ec823/bytelines-2.1.0/src/lib.rs:124
  12: runiq::main
             at src/main.rs:67
  13: std::rt::lang_start::{{closure}}
             at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  14: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  15: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  16: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  17: std::panicking::try
             at src/libstd/panicking.rs:275
  18: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  19: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  20: std::rt::lang_start
             at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  21: runiq::main

Here is my system's info:

runiq on  master [!?] is 📦 v1.1.3 via 🦀 v1.38.0 
❯ rustc --version --verbose
rustc 1.38.0 (625451e37 2019-09-23)
binary: rustc
commit-hash: 625451e376bb2e5283fc4741caa0a3e8a2ca4d54
commit-date: 2019-09-23
host: x86_64-apple-darwin
release: 1.38.0
LLVM version: 9.0

Again, thanks in advance.

whitfin commented 4 years ago

@pjox this is interesting, because the cargo install runiq command only has one commit missing, which is just linting changes. Can you provide me a link to the exact file you're running this on? I know you pasted text above, but I want to make sure I get the correct encoding etc.

pjox commented 4 years ago

Thank you so much for the reply! (and sorry for the delay in answering!). The text file is plain text crawled from French websites and it should be in UTF-8. The panic occurs as soon as runiq encounters an empty newline between two paragraphs. I was also able to replicate the panic on a linux computer, so it is not specific to MacOS. Here is a link to the file: https://pjortiz.com/files/fr_test.txt

whitfin commented 4 years ago

Hi @pjox!

I was able to reproduce this and it has been resolved in master; the Cargo.lock in the repository was pinned on a bad version of a dependency which is why you only saw the issue when cloning. I have updated the dependencies as well to avoid any further issues.

Can you please try it and let me know? When I use your sample file, it appears to be fixed.

pjox commented 4 years ago

Hello @whitfin!

I can confirm the issue is fixed. Thank you so much!