Operating System - HP-UX
1752810 Members
5916 Online
108789 Solutions
New Discussion юеВ

Re: Crashes in sprintf saying memory not mapped to object

 
K!rn Kumr
Frequent Advisor

Crashes in sprintf saying memory not mapped to object

I have a crash in my code. It is a multithreaded application nd so i am compiling it with -mt so that it is thread safe as we had earlier faced issue with this. But even now i have such error below is the backtrace

#0 0xc000000000338ab0:0 in T_19_73d5_cl___doprnt_main+0x85c0 ()
from /usr/lib/hpux64/libc.so.1
#1 0xc000000000328170:0 in _doprnt+0x30 () from /usr/lib/hpux64/libc.so.1
#2 0xc00000000034b7c0:0 in sprintf+0x100 () from /usr/lib/hpux64/libc.so.1
#3 0x4000000000019050:0 in MakeDatabaseCall (in_record={
NSN_Nr = "29999999\000\000|146|Re"}, out_record=0x9fffffffffffcec0)
at /hubd/home/id817019/xxx/src/xyz.pc:492
#4 0x4000000000016770:0 in S4202_PortingOperatorIdRetrieve (
reqbuffer=0x600000000015a530 "", respbuffer=0x9fffffffffffd320)
at /hubd/home/id817019/xxx/src/xyz.pc:280
#5 0x40000000000138b0:0 in S_4202 (rqst=0x600000000002a6d0)
at /hubd/home/id817019/xxx/src/xyz.pc:151
#6 0xc0000000035ccb50:0 in _tmsvcdsp () at tmsvcdsp.c:496
#7 0xc000000003625820:0 in _tmrunserver () at tmrunsvr.c:2014
#8 0xc0000000035caf60:0 in _tmstartserver () at tmstrtsrvr.c:148
3 REPLIES 3
Laurent Menase
Honored Contributor

Re: Crashes in sprintf saying memory not mapped to object

you should look parameters in registers at frame 2 - or out registers at frame3
then check sprintf parameters.

but this looks like one of the parameter is corrupted. - like a string at a bad address in params due to some corruption.

K!rn Kumr
Frequent Advisor

Re: Crashes in sprintf saying memory not mapped to object

yeah i was passing bad parameters to it. for copying an interger to string i was using a string format specifier instead of integer format specifier
Dennis Handly
Acclaimed Contributor

Re: Crashes in sprintf saying memory not mapped to object

>i was passing bad parameters to it. for copying an integer to string i was using a string format specifier instead of integer format specifier

If you use aCC6, the compiler should warn if your formats don't match your arguments.