When listing symbols in a lib file, it crashed here. #0 coff_slurp_symbol_table (abfd=0x16e3888) at coffcode.h:4519 #1 0x0040f9fc in coff_get_symtab_upper_bound (abfd=0x16e3888) at coffgen.c:338 #2 0x004057ac in _bfd_generic_read_minisymbols (abfd=0x16e3888, dynamic=0, minisymsp=0xe2cc60, sizep=0xe2cc5c) at syms.c:808 #3 0x0040268e in display_rel_file (abfd=0x16e3888, archive_bfd=0x166b0e0) at nm.c:1006 #4 0x00402b15 in display_archive (file=0x166b0e0) at nm.c:1147 #5 0x00402c2e in display_file (filename=0xe2cd6d "/d/WebCoreediting.lib") at nm.c:1195 #6 0x004037d0 in main (argc=2, argv=0x166ae40) at nm.c:1661
Here is the code, the sym variable got a value as 1, /* FIXME: We should not be casting between ints and pointers like this. */ sym = ((coff_symbol_type *) ((symndx + obj_raw_syments (abfd)) ->u.syment._n._n_n._n_zeroes)); then it crashed at if (sym->lineno != NULL && ! warned) I'm proposing a solution as below, to check the sym after setting its value. //brook if(sym < obj_symbols (abfd) ) { _bfd_error_handler (_("%B: warning: illegal symbol address %x, which should be greater than %x"), abfd, sym, obj_symbols (abfd)); continue; } -- Summary: nm crashes when handling some lib file. Product: binutils Version: 2.21 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: hzgmaxwell at sohu dot com CC: bug-binutils at gnu dot org GCC build triplet: cygwin GCC host triplet: mingw32 GCC target triplet: mingw32 http://sourceware.org/bugzilla/show_bug.cgi?id=11430 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils