Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH]prec: record_arch_list_add_mem add check for len
@ 2010-07-19  8:08 Hui Zhu
  2010-07-20 12:51 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2010-07-19  8:08 UTC (permalink / raw)
  To: gdb-patches ml

Add this check for some code maybe len < 0.

Thanks,
Hui

2010-07-16  Hui Zhu  <teawater@gmail.com>

	* record.c (record_arch_list_add_mem): Add check for len.


---
 record.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/record.c
+++ b/record.c
@@ -497,6 +497,8 @@ record_arch_list_add_mem (CORE_ADDR addr

   if (!addr)	/* FIXME: Why?  Some arch must permit it... */
     return 0;
+  if (len <= 0)
+    return 0;

   rec = record_mem_alloc (addr, len);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH]prec: record_arch_list_add_mem add check for len
  2010-07-19  8:08 [PATCH]prec: record_arch_list_add_mem add check for len Hui Zhu
@ 2010-07-20 12:51 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2010-07-20 12:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Hui Zhu

On Monday 19 July 2010 09:08:17, Hui Zhu wrote:
> Add this check for some code maybe len < 0.

How can len < 0 happen?  Wouldn't that be a bug?

> 
> Thanks,
> Hui
> 
> 2010-07-16  Hui Zhu  <teawater@gmail.com>
> 
> 	* record.c (record_arch_list_add_mem): Add check for len.
> 
> 
> ---
>  record.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/record.c
> +++ b/record.c
> @@ -497,6 +497,8 @@ record_arch_list_add_mem (CORE_ADDR addr
> 
>    if (!addr)	/* FIXME: Why?  Some arch must permit it... */
>      return 0;
> +  if (len <= 0)
> +    return 0;
> 
>    rec = record_mem_alloc (addr, len);
> 


-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-20 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-19  8:08 [PATCH]prec: record_arch_list_add_mem add check for len Hui Zhu
2010-07-20 12:51 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox