This is the mail archive of the gdb-prs@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]

[Bug remote/18721] New: endless loop in sh-stub.c


https://sourceware.org/bugzilla/show_bug.cgi?id=18721

            Bug ID: 18721
           Summary: endless loop in sh-stub.c
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: remote
          Assignee: unassigned at sourceware dot org
          Reporter: pipcet at gmail dot com
  Target Milestone: ---

I would like to report the following bug in sh-stub.c, which affected me when
using the file as a template for my own gdb stubs file:

diff --git a/gdb/stubs/sh-stub.c b/gdb/stubs/sh-stub.c
index 76c98a5..20407a0 100644
--- a/gdb/stubs/sh-stub.c
+++ b/gdb/stubs/sh-stub.c
@@ -469,7 +469,7 @@ putpacket (char *buffer)
          /* Do run length encoding */
          for (runlen = 0; runlen < 100; runlen ++) 
            {
-             if (src[0] != src[runlen]) 
+             if (src[0] != src[runlen] || runlen == 99) 
                {
                  if (runlen > 3) 
                    {

Without this fix, putpacket() will loop endlessly when presented with an
all-zero buffer.

Thanks!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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