Crash with alias in KEYCONF that is > 4090

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Crash with alias in KEYCONF that is > 4090

Re: Crash with alias in KEYCONF that is > 4090

by Graf Zahl » Sat Mar 03, 2018 2:11 am

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

Re: Crash with alias in KEYCONF that is > 4090

by m8f » Sat Mar 03, 2018 2:09 am

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.

Re: Crash with alias in KEYCONF that is > 4090

by _mental_ » Sat Mar 03, 2018 2:00 am

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.

Re: Crash with alias in KEYCONF that is > 4090

by Graf Zahl » Sat Mar 03, 2018 1:40 am

The KEYCONF parser uses a fixed size buffer of 4096 bytes. Congratulations, you are the first person to exceed it!

Crash with alias in KEYCONF that is > 4090

by m8f » Fri Mar 02, 2018 10:23 pm

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

Top