sleroux / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

Linux: Crash when generating large .sym files with dump_syms #259

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
*What steps will reproduce the problem?
1. Compile linux/dump_syms or use the file attached
2. run ./dump_syms ./dump_syms

outcome:
linux:~/work/dml/3rdParty/breakpad_r259/src/tools/linux/dump_syms$ 
MODULE Linux x86 408BE7214EB4DDB90EBB9D9033811B340 dump_syms
FILE 0 ../../../common/linux/dump_symbols.cc
FILE 1 ../../../common/linux/guid_creator.cc
FILE 2 dump_syms.cc
FILE 3 ../../../common/linux/file_id.cc
FILE 4 ../../../common/md5.c
FILE 5 /usr/include/c++/4.1.3/new
FILE 6 ../../../common/linux/file_id.h
FILE 7 /usr/include/c++/4.1.3/bits/stl_iterator.h
FILE 8 /usr/include/c++/4.1.3/ext/new_allocator.h
FILE 9 /usr/include/c++/4.1.3/bits/stl_vector.h
FILE 10 /usr/include/c++/4.1.3/bits/allocator.h
FILE 11 /usr/include/c++/4.1.3/bits/stl_function.h
Segmentation fault (core dumped)

I have attached the ouput from valgrind.

*What version of the product are you using? On what operating system?
I am using breakpad revision 259 on kubuntu 7.10.

*Please provide any additional information below.

Essentially the problem is in the current usage of vectors. In the function
AddIncludedFiles, you simply cannot iterate on the
symbols->source_file_info vector while pushing more SourceFileInfo at the
end. The reason for this is that if you reach the maximum size of the
vector, then a new larger chunk of memory must be allocated so all items
can be copied into it. This effectively invalidate all iterators and so the
struct references no longer point to valid memory. Reference:

"[2] Memory will be reallocated automatically if more than capacity() -
size() elements are inserted into the vector. Reallocation does not change
size(), nor does it change the values of any elements of the vector. It
does, however, increase capacity(), and it invalidates [5] any iterators
that point into the vector." - http://www.sgi.com/tech/stl/Vector.html

I have reimplemented the code using lists instead as a workaround. This way
the structure of the code remains intact. You will find the patch attached
to this report.

Original issue reported on code.google.com by login_...@yahoo.com on 23 Apr 2008 at 11:52

Attachments:

GoogleCodeExporter commented 9 years ago
Liu Li should take a look at this.

Original comment by ted.mielczarek on 24 Apr 2008 at 1:46

GoogleCodeExporter commented 9 years ago
Sorry for the late reply, thanks for fixing this!

Before submitting, please fix the indent of the patch.
Could you also tell me why the "typedef" in the patch are all starting with "v" 
in
the type name?

Thanks!

Original comment by lul...@gmail.com on 21 May 2008 at 8:08

GoogleCodeExporter commented 9 years ago
I cleaned this up a bit and landed it:
http://code.google.com/p/google-breakpad/source/detail?r=296

Original comment by ted.mielczarek on 24 Nov 2008 at 8:51