This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: Run length encoding bug in remote.c?
- To: Orjan Friberg <orjan dot friberg at axis dot com>
- Subject: Re: RFC: Run length encoding bug in remote.c?
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 10 Aug 2001 03:11:25 -0400
- Cc: gdb-patches at sources dot redhat dot com
- References: <3B714363.F2A28837@axis.com>
> The patch below makes that change. Though this works (tested with
> "print *current" in gdb) and looks sensible to me, I have a feeling that
> this error should show up quite often for other people as well, since it
> would happen every time the response to an 'm' packet ends with
> run-length encoding of the data.
I don't know that many targets use run-length incoding and hence,
probably few have noticed the bug.
> I suspect that the (bc + repeat) in the condition should in fact be (bc
> + repeat - 1) since the memset begins already at position bc in buf,
> which means that the last position in buf to be memsetted is at position
> (bc + repeat - 1). *That* position must be < sizeof_buf - 1 to allow
> room for null-termination of buf.
Yes, I'm convinced - my walk through came up with the assertion ``bc +
repeat <= sizeof_buf - 1'' which is equivalent to your patch.
So approved.
Andrew