This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix agent code generate bug of ref


>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:

Hui> Sorry for my misunderstand in your mail.  Accord to discussion with
Hui> Yao in IRC.  I merge 2 patches together.
Hui> And I found that gdb_assert of access_memory.  It should use nbytes.

Thanks for doing this.

Hui> 2013-03-12  Yao Qi  <yao@codesourcery.com>
Hui> 	    Hui Zhu  <hui_zhu@mentor.com>
Hui> 	* dwarf2loc.c (access_memory): Change nbits to nbytes in gdb_assert.
Hui> 	(dwarf2_compile_expr_to_ax): Call access_memory in DW_OP_deref and
Hui> 	DW_OP_deref_size.

Hui> +  gdb_assert (nbytes > 0 && nbytes <= sizeof (LONGEST));

Hui> -	      default:
Hui> -		/* Note that get_DW_OP_name will never return
Hui> -		   NULL here.  */
Hui> -		error (_("Unsupported size %d in %s"),
Hui> -		       size, get_DW_OP_name (op));
Hui> -	      }

I think we need a sanity check before calling access_memory.
Otherwise, bad DWARF will be able to crash gdb.
The patch is ok with that change.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]