ggreer / the_silver_searcher

A code-searching tool similar to ack, but faster.
http://geoff.greer.fm/ag/
Apache License 2.0
26.18k stars 1.43k forks source link

segfault in 0.29 #599

Closed smolyn closed 9 years ago

smolyn commented 9 years ago

Trying to search a directory as I have before, I get a segfault. I compiled a binary and ran it in gdb, here's some debug info:

(gdb) run editCommentAction Starting program: /Users/gsmolyn/the_silver_searcher/ag editCommentAction warning: Could not open OSO archive file "/BinaryCache/corecrypto/corecrypto-233.1.2~26/Symbols/BuiltProducts/libcorecrypto_static.a" warning: `/BinaryCache/coreTLS/coreTLS-35.1.2~2/Objects/coretls.build/coretls.build/Objects-normal/x86_64/system_coretls_vers.o': can't open to read symbols: No such file or directory. warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.1.2~2/Symbols/BuiltProducts/libcoretls_ciphersuites.a" warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.1.2~2/Symbols/BuiltProducts/libcoretls_handshake.a" warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.1.2~2/Symbols/BuiltProducts/libcoretls_record.a" warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.1.2~2/Symbols/BuiltProducts/libcoretls_stream_parser.a" [New Thread 0x111b of process 37592] [New Thread 0x1203 of process 37592] [New Thread 0x1303 of process 37592] [New Thread 0x1403 of process 37592] [New Thread 0x1503 of process 37592] [New Thread 0x1603 of process 37592] [New Thread 0x1703 of process 37592]

Program received signal SIGSEGV, Segmentation fault. filename_filter (path=0x1002000a0 ".", dir=0x100803000, baton=) at src/ignore.c:382 382 if (filename[i] == '.') { (gdb) bt

0 filename_filter (path=0x1002000a0 ".", dir=0x100803000, baton=) at src/ignore.c:382

1 0x000000010000586d in ag_scandir (dirname=0x100803015 "filter-api", namelist=0x7fff5fbff3d8, filter=0x1, baton=0x7fff5fbff3c0) at src/scandir.c:28

2 0x0000000100006b0d in search_dir (ig=0x1002001f0, base_path=0x10000ec40 "", path=0x1 <error: Cannot access memory at address 0x1>, depth=0, original_dev=0) at src/search.c:425

3 0x0000000100008e69 in main (argc=, argv=) at src/main.c:169

(gdb) f 0

0 filename_filter (path=0x1002000a0 ".", dir=0x100803000, baton=) at src/ignore.c:382

382 if (filename[i] == '.') { (gdb) p i $1 = <optimized out> (gdb) p filename $2 = 0x100803015 "filter-api"

smolyn commented 9 years ago

filter-api is a directory

smolyn commented 9 years ago

Line 382 is for (i = filename_len - 1; filename_len > 1; i--) {

I think that second filename_len is supposed to be i?

ggreer commented 9 years ago

I just noticed this issue after pushing a fix for #598. Master and 0.29.1 should work fine for you.

krazylegz commented 9 years ago

Thanks! :+1: