Comments (6)
Question is, should we (1) just break loops if newargc
reaches MAXARGVS
and break silently, or (2) abort with an error message or (3) reallocate the newargv[]
array and accept an arbitrary number of arguments?
from chocolate-doom.
I opt for (2). We have functions like M_FindResponseFile and SetupMission, which will silently ignore extra arguments (so chocolate-doom.exe -response resp1 resp2 ...
will be treated as chocolate-doom.exe -response resp1
, and chocolate-setup.exe -game doom heretic ...
as chocolate-setup.exe -game doom
), but they are simply applying the parsing rules, so the user should be aware of how the program will treat each parameter when using them. I would discard option (3), because then we would have to throw away MAXARGVS
macro all together, which would break the accuracy with the original code. Considering we want to keep MAXARGVS
and that most users don't know about the arguments limit, then (2) seems the appropriate solution.
from chocolate-doom.
Well (1) is definitely wrong. I don't think vanilla supported response files so compatibility is not an issue. (2) sounds easiest to implement. I don't see a need for (3) and it sounds complicated.
I vote for (2).
from chocolate-doom.
@turol Original Doom supported response files through @respfile syntax. Chocolate Doom added the option to load response files using -response respfile, because the original syntax was causing some problems in Linux. You can still use the original syntax with Chocolate Doom tough, if you like it. Also, option (3) is not that difficult to implement, we just have to drop the MAXARGVS
and call realloc when appropriate while reading the file. We could create a new function, maybe void M_ParseResponseFile(char **newargv, char *respfile)
, and reuse most of the while loop to implement the reallocation. The reason that option (3) is bad, at least in my opinion, is that we would be driving away too much from the original code if we drop the MAXARGVS
.
from chocolate-doom.
What does vanilla do if it's passed too many arguments via response file? Ignore them? Crash? Misbehave in some other way?
from chocolate-doom.
@turol Superficially, it looks like the original Doom code seems to allow a buffer overflow. But it may be the case that a buffer overflow would never happen due to some hardware/OS limitation of the time. Also, a second buffer overflow could happen in the original code when filling the array char *moreargs[20];
at this line of code, if myargc - i >= 19
. This one can't happen in Chocolate Doom, because we do not use moreargs
anymore. I think the only way to be sure is to confirm with Carmack if these problem were mapped at the time, or run a old machine with DOS + DOOM with a big enough response file.
from chocolate-doom.
Related Issues (20)
- snd_musiccmd option ignored (linux) HOT 8
- Sound problems (Heretic and Hexen) HOT 10
- no music with surround sound on HOT 5
- Configuration files directory differs from Vanilla Doom HOT 4
- Incorrect behavior for lost souls in Chex Quest with chex.deh HOT 1
- Setup using wrong color palette HOT 4
- Compilation Errors in Chocolate Doom on Debian: SDL2 and sound.c HOT 2
- Hexen: autosaves cause problems with -demoextend multi-level demos HOT 2
- Hexen: possible desync on multi-level demo (and now single map demo) HOT 12
- Heretic: Segfault in rooms3.wad HOT 7
- Add more gamepad binds to Heretic and Hexen #1666 - Dpad not being recognized HOT 6
- Someone needs to send a GPL compliance email to Husqvarna AB HOT 1
- Bus Error on startup HOT 3
- Possible UB when setting skill level HOT 23
- Buffer overflow in `R_GenerateLookup`
- PK3 Support HOT 3
- Fails to start with GPU HOT 1
- [Error] SIGIL HOT 3
- Missing padding in save files after `floormove_t::texture` field
- Mouse Only Intermittently Works In ChromeOS Linux HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chocolate-doom.