double-free or corruption when building database
eapache opened this issue · 7 comments
Given the following cscope and ctags databases (I gzipped them for sharing, so uncompress them first) to cqmakedb
reliably causes a crash.
https://dl.dropboxusercontent.com/u/171647/codequery-samples/cscope.out.gz
https://dl.dropboxusercontent.com/u/171647/codequery-samples/tags.gz
The complete output:
➜ wireshark (master) cqmakedb -s ../cq.db -c cscope.out -t tags
cscope.out sanity check OK
cscope.out detailed check OK
Adding symbols ...
Finalizing ...
Processing ctags file ...
*** Error in `cqmakedb': double free or corruption (!prev): 0x00000000015cad60 ***
[1] 31449 abort (core dumped) cqmakedb -s ../cq.db -c cscope.out -t tags
(The two databases were generated pretty generically from a recent checkout of Wireshark trunk)
I could not reproduce this using the wireshark code, but I could reproduce this using your copies of cscope.out and tags. I'll check using that. Thanks.
Program received signal SIGSEGV, Segmentation fault.
0x000000355708036c in free () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.18-12.fc20.x86_64 libgcc-4.8.2-7.fc20.x86_64 libstdc++-4.8.2-7.fc20.x86_64 sqlite-3.8.4.3-1.fc20.x86_64
(gdb) backtrace
#0 0x000000355708036c in free () from /lib64/libc.so.6
#1 0x00000000004140a5 in tempbuf::~tempbuf (this=0x7fffffffde50, __in_chrg=<optimized out>) at /home/ruben/git-repo/codequery/querylib/small_lib.cpp:248
#2 0x0000000000410a9b in ctagread::process_ctags (this=0x7fffffffdf40) at /home/ruben/git-repo/codequery/makedb/ctagread.cpp:128
#3 0x00000000004131e8 in process_ctags (ctagsfn=0x61c058 "tags", sqfn=0x61c0e8 "a.db", debug=true) at /home/ruben/git-repo/codequery/makedb/main.cpp:138
#4 0x0000000000413719 in main (argc=8, argv=0x7fffffffe108) at /home/ruben/git-repo/codequery/makedb/main.cpp:291
Hi Evan,
Could you try rebuilding your tags file using one of these?
ctags --fields=+i -n -R -L ./cscope.files
or if you don't want to specify a list of files but prefer to search recursively:
ctags --fields=+i -nR
I find that your attached tags file does not follow the required format, but if you use the above parameters, it should be now readable by cqmakedb.
Unfortunately, cqmakedb only accepts a subset of the ctags output format at the moment.
That's odd, I can't reproduce at all now. No longer a problem for me, but I guess I'll leave this open so you can add sanity checks like the cscope ones - an informative error message would be much better than a crash.
Thanks. That's a good idea.