Opened 10 years ago

Closed 10 years ago

#5676 closed bug (fixed)

BMessage::PrintToStream crashes on Int8

Reported by: MrSunshine Owned by: axeld
Priority: normal Milestone: R1
Component: Kits/Application Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

#include <stdio.h> 
#include <app/Message.h> 
#include <support/DataIO.h> 
#include <string.h> 
 
int main() { 
        BMessage msg; 
 
        msg.AddInt8("testing", 8); 
 
        msg.PrintToStream(); 
 
        return 0; 
} 

crashes for me with latest rev of haiku hrev36029 Works fine with Int16 or Int32 tho

Change History (8)

comment:1 by jackburton, 10 years ago

Gcc 4 hybrid, I presume ?

I fixed a similar bug some time ago, btw.. can't find the ticket.

comment:2 by jackburton, 10 years ago

Oh, btw... backtrace would be useful :)

comment:3 by humdinger, 10 years ago

I see that too, with gcc4hybrid. Backtrace:

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-haiku"...
[tcsetpgrp failed in terminal_inferior: Invalid Argument]
Thread 3675 caused an exception: Segment violation
Reading symbols from /boot/system/runtime_loader...done.
Loaded symbols for /boot/system/runtime_loader
Reading symbols from /boot/system/lib/libroot.so...done.
Loaded symbols for /boot/system/lib/libroot.so
Reading symbols from /boot/system/lib/libbe.so...done.
Loaded symbols for /boot/system/lib/libbe.so
Reading symbols from /boot/system/lib/libstdc++.so...done.
Loaded symbols for /boot/system/lib/libstdc++.so
Reading symbols from /boot/system/lib/libsupc++.so...done.
Loaded symbols for /boot/system/lib/libsupc++.so
[tcsetpgrp failed in terminal_inferior: Invalid Argument]
[Switching to team /boot/home/projects/test/test (3675) thread test (3675)]
0x0028f6d5 in strnlen () from /boot/system/lib/libroot.so
(gdb) bt
#0  0x0028f6d5 in strnlen () from /boot/system/lib/libroot.so
#1  0x002683de in vfprintf () from /boot/system/lib/libroot.so
#2  0x002620ef in printf () from /boot/system/lib/libroot.so
#3  0x003af503 in BMessage::_PrintToStream () from /boot/system/lib/libbe.so
#4  0x003af844 in BMessage::PrintToStream () from /boot/system/lib/libbe.so
#5  0x0020097f in main () at /boot/home/projects/test/test.cpp:11
(gdb) 

comment:4 by jackburton, 10 years ago

That looks exactly like the one I fixed. Are you both sure you upgraded Haiku correctly ?

comment:5 by humdinger, 10 years ago

I always build my images directly to a partition, overwriting /boot. I then play back a zipped archive of ~/home. So, as long as there's nothing changed with some setting there, it should be OK.
Have you tested the above code? Does it work for you?

in reply to:  5 comment:6 by jackburton, 10 years ago

Replying to humdinger:

I always build my images directly to a partition, overwriting /boot. I then play back a zipped archive of ~/home. So, as long as there's nothing changed with some setting there, it should be OK.

Have you tested the above code? Does it work for you?

Not yet, since I don't have access to my development machine.

comment:7 by jackburton, 10 years ago

It's #5596, btw.

comment:8 by jackburton, 10 years ago

Resolution: fixed
Status: newclosed

It's fixed in hrev36052.

Note: See TracTickets for help on using tickets.