Crash with alias in KEYCONF that is > 4090

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
m8f
 
 
Posts: 1467
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)
Contact:

Crash with alias in KEYCONF that is > 4090

Post by m8f »

Two files: bad.pk3 and good.pk3.
Both contain a KEYCONF lump with alias "alias1".
In good.pk3, alias1 has length of 4089. good.pk3 is loaded without problems.
In bad.pk3, alias1 has length of 4090. GZDoom crashes on loading bad.pk3:
Spoiler:
No message about problem source is seen, so user who created such an alias has to understand by himself that the problem is in alias length.

You can see that good.pk3:KEYCONF contains more text than bad.pk3, so the problem is not KEYCONF size, but the size of alias.

I see several possible solutions:
  • crash with message about too big alias
  • ignore too big aliases with a warning
Attachments
gzdoom-crash.log.txt
(13.81 KiB) Downloaded 24 times
bad.pk3
(164 Bytes) Downloaded 26 times
good.pk3
(186 Bytes) Downloaded 22 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Crash with alias in KEYCONF that is > 4090

Post by Graf Zahl »

The KEYCONF parser uses a fixed size buffer of 4096 bytes. Congratulations, you are the first person to exceed it!
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash with alias in KEYCONF that is > 4090

Post by _mental_ »

It's fairly easy to support arbitrary line lengths in KEYCONF, at cost of heap allocation(s) of course.
Usefulness of this is questionable but crash will be fixed as a side effect.
User avatar
m8f
 
 
Posts: 1467
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)
Contact:

Re: Crash with alias in KEYCONF that is > 4090

Post by m8f »

About usefulness - there would be no need to write long aliases if wait commands were serialized (described here).
If commands with 'wait' could be aliased safely, it would be sufficient just to issue a warning on too long lines (warning would ask to divide line to aliases), and then ignore long lines. And there would be no need to support arbitrary lengths.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Crash with alias in KEYCONF that is > 4090

Post by Graf Zahl »

Fixing the buffer overflow is a lot simpler than redesigning the entire system, though.
Post Reply

Return to “Closed Bugs [GZDoom]”