Bug 3065 - Special key that causes IoQ3 to crash
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: 1.33 SVN
Hardware: PC FreeBSD
: P2 major
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2007-03-18 19:35 EDT by hika
Modified: 2007-05-21 11:27:27 EDT
1 user (show)

See Also:


Attachments
svn1051 XLookupString fix (420 bytes, patch)
2007-03-19 14:10 EDT, Tony J. White

Description hika 2007-03-18 19:35:04 EDT
For many weeks, I found that pressing the '
Comment 1 hika 2007-03-18 19:44:57 EDT
For many weeks, I found that pressing the 
Comment 2 hika 2007-03-18 19:46:20 EDT
For many weeks, I found that pressing the 'à' key (with an AZERTY keyboard, fr keymap) causes IoQ3 to crash.
This happen anywhere in the game (Console, InGame, When chatting ... etc).
So, I have made some investigation, and found out some strange things in ./code/client/cl_keys.c: CL_KeyEvent()
When I pressed the 'à' key, the key variable value was -24 (0xffffffe8) instead of 232 (0x000000e8).
So, curious I am, I have walked up the code to ./code/unix/linux_glimp.c: XLateKey().
I noticed that *key got the -24 in the following code :

*key = bufnomod[0];

and since in_shiftedKeys cvar is "0" by default ...

Well, I hope I might be a help so you can fix it ;)
Comment 3 Tony J. White 2007-03-19 13:23:16 EDT
(In reply to comment #2)
> So, curious I am, I have walked up the code to ./code/unix/linux_glimp.c:
> XLateKey().
> I noticed that *key got the -24 in the following code :
> 
> *key = bufnomod[0];
> 
> and since in_shiftedKeys cvar is "0" by default ...

It looks like you're not using SDL.  Is that correct?
Comment 4 Tony J. White 2007-03-19 14:10:27 EDT
Created attachment 1294 [details]
svn1051 XLookupString fix

Can you please try this patch?

The char buffer filled by XLookupString in linux_glimp.c was not unsigned char which was allowing the negative values.  I'm not sure if this is all that's required to fix your issue, but it should stop the crashing at least.

Should XK_agrave and XK_Agrave be translated to something else like 'A' and 'a'?  I don't think they have glyphs do they?
Comment 5 hika 2007-03-19 16:22:39 EDT
(In reply to comment #3)
> 
> It looks like you're not using SDL.  Is that correct?
> 

Yes.

(In reply to comment #4)
> Created an attachment (id=1294) [details]
> svn1051 XLookupString fix
> 
> Can you please try this patch?
> 
> The char buffer filled by XLookupString in linux_glimp.c was not unsigned char
> which was allowing the negative values.  I'm not sure if this is all that's
> required to fix your issue, but it should stop the crashing at least.
> 

This is what I was about to do, after my investigation ;)
I tried your patch and the crash no longer appears.

> Should XK_agrave and XK_Agrave be translated to something else like 'A' and
> 'a'?  I don't think they have glyphs do they?
> 

Sorry about the 'à' key, but in fact I meant 'è' ('232' byte value).
Yeah, maybe you can "translate" 'à' to 'a' and 'è to 'e' ?
Comment 6 Tony J. White 2007-03-19 17:56:25 EDT
(In reply to comment #5)

> I tried your patch and the crash no longer appears.
> 

Applied at revision 1052.

> > Should XK_agrave and XK_Agrave be translated to something else like 'A' and
> > 'a'?  I don't think they have glyphs do they?
> > 
> 
> Sorry about the 'à' key, but in fact I meant 'è' ('232' byte
> value).
> Yeah, maybe you can "translate" 'à' to 'a' and 'è to 'e' ?

I'm closing this bug for now.  If translation of certain keys is desiriable it should probably be a new enhancement ticket.
Comment 7 Ryan C. Gordon 2007-05-21 11:27:27 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.