> From: Stephen A Tang [mailto:[EMAIL PROTECTED]]
>  "QTest" (unknown version) is attempting to change the emulated
>  program counter to 0x69696969.

That error almost always means the stack got trashed, such as by a buffer
overrun bug.  In this case, note that 0x69696969 equals 'iiii'.  A clue?

> Here's the relevant fragment of my code:
>   H = (Handle)MemHandleNew(2000);
>   sendStr = (char *)MemHandleLock((VoidHand)H);
>   StrCopy(sendStr, "iiiii.....iiiiiiiii");
>   printf("sendstr = \n%s",sendStr);

Yes, it looks like a long string of i's is overwriting the stack.  But your
code seems to be safely copying all those i's into a heap chunk where it
can't hurt the stack.  But what about that printf call?

> this only seems to happen if the final length of sendStr
> exceeds a certain value (around 115 characters).
> Also, if I get rid of the printf, the error does not occur.

Aha!  So if you pass printf a string above a certain size, that string ends
up stomping all over the stack.  That's certainly suspicious.

Now where did this printf function come from anyway?  Did you write it
yourself, or is this the StdIOPalm.c module from Palm?  If the latter, where
did you get it?  (I can't find the StdIO source files anywhere!)  Either
way, look in the code for any unsafe buffer size assumptions that could lead
to this kind of bug.

-slj-


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to