Skip to contentSkip to conversation

[5087] Fix more bugs in r5044

Qemu-devel Blue Swirl 3 participants 4 messages Aug 25, 2008 – Aug 26, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 5087

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5087
Author:   blueswir1
Date:     2008-08-25 20:43:37 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
Fix more bugs in r5044

Modified Paths:
--------------

    trunk/audio/audio.c
    trunk/i386-dis.c

Modified: trunk/audio/audio.c
===================================================================

audio/audio.c +1 -1
@@ -205,7 +205,7 @@
     }
 
     len = strlen (s);
-    r = qemu_malloc (len + sizeof (qemu_prefix));
+    r = qemu_malloc (len + sizeof (qemu_prefix) + 1);
 
     if (r) {
         size_t i;

Modified: trunk/i386-dis.c
===================================================================

i386-dis.c +1 -1
@@ -2826,7 +2826,7 @@
 oappend (s)
      const char *s;
 {
-  pstrcpy (obufp, (size_t)(obufp - obuf), s);
+  pstrcpy (obufp, sizeof(obuf) - (size_t)(obufp - obuf), s);
   obufp += strlen (s);
 }
 
#1 lore raw
Quoted 20 lines · Blue Swirl

Revision: 5087

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5087
Author:   blueswir1
Date:     2008-08-25 20:43:37 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
Fix more bugs in r5044

Modified Paths:
--------------
trunk/audio/audio.c
trunk/i386-dis.c

Modified: trunk/i386-dis.c
===================================================================

i386-dis.c 2008-08-25 20:43:37 UTC (rev 5087) line 2832

Quoted 8 lines
i386-dis.c 2008-08-25 20:43:37 UTC (rev 5087) renamed from i386-dis.c 2008-08-25 20:03:28 UTC (rev 5086) +1 -1
@@ -2826,7 +2826,7 @@
 oappend (s)
     const char *s;
 {
-  pstrcpy (obufp, (size_t)(obufp - obuf), s);
+  pstrcpy (obufp, sizeof(obuf) - (size_t)(obufp - obuf), s);
  obufp += strlen (s);
 }
 

Now the disassembler output is truncated; you need to revert this part of change to i386-dis.c
The problem is that obufp is not always a pointer into obuf data, see
i386-dis.c:2497 obufp = op1out;

Signature · 2 lines
Kind regards,
Igor V. Kovalenko
author
#2 lore raw
Quoted 28 lines · Igor Kovalenko
Quoted 27 lines · Blue Swirl

Revision: 5087

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5087
Author:   blueswir1
Date:     2008-08-25 20:43:37 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
Fix more bugs in r5044

Modified Paths:
--------------
trunk/audio/audio.c
trunk/i386-dis.c

Modified: trunk/i386-dis.c
===================================================================

i386-dis.c 2008-08-25 20:43:37 UTC (rev 5087) renamed from i386-dis.c 2008-08-25 20:03:28 UTC (rev 5086) +1 -1
@@ -2826,7 +2826,7 @@
 oappend (s)
     const char *s;
 {
-  pstrcpy (obufp, (size_t)(obufp - obuf), s);
+  pstrcpy (obufp, sizeof(obuf) - (size_t)(obufp - obuf), s);
  obufp += strlen (s);
 }
Quoted 8 lines
Quoted 2 lines

Now the disassembler output is truncated; you need to revert this part
of change to i386-dis.c
The problem is that obufp is not always a pointer into obuf data, see
i386-dis.c:2497 obufp = op1out;

Thanks. I didn't have a plan how to fix this properly, so I reverted it.

#3 lore raw
In reply to Blue Swirl
Quoted 19 lines · Blue Swirl

Revision: 5087

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5087
Author:   blueswir1
Date:     2008-08-25 20:43:37 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
Fix more bugs in r5044

Modified Paths:
--------------
trunk/audio/audio.c
trunk/i386-dis.c

Modified: trunk/audio/audio.c
===================================================================

audio/audio.c line 209

Quoted 6 lines
audio/audio.c +1 -1
@@ -205,7 +205,7 @@
    }
 
    len = strlen (s);
-    r = qemu_malloc (len + sizeof (qemu_prefix));
+    r = qemu_malloc (len + sizeof (qemu_prefix) + 1);
 

This is wrong, sizeof (qemu_prefix) already includes + 1 (trailing zero is counted).

Signature · 1 line
mailto:[email protected]