DaDummy / g2ext

Automatically exported from code.google.com/p/g2ext
3 stars 1 forks source link

[Starter] ini parser crashes on special ini file content #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Have an ini file in your system directory that contains the following 
field:

{{{
...
Description = {\rtf1\qc\b\ Zaphod´s Gothic Racer\b0\par Die erste 
Rennsimulation für Gothic. Setz Dich auf ein Fass und stürze den Abhang 
hinunter.\par 5 Fahrzeuge können mit erfolgreichen Abfahrten freigeschaltet 
werden. Ob Du rasant den Berg herunter fährst, versteckte Bonus-Punkte 
findest, oder mit gewagten Sprüngen Zeitgutschriften sammelst, das Ziel 
bleibt immer gleich:\par\b Schaffst Du es, die Highscore zu knacken?
\b0\par\par Eine Weihnachtsmodifikation 2009 im WoG von Zaphod Beeblebrox 
und Milky-Way\par Bei Problemen, Fragen, oder Anregungen:\par 
http://forum.worldofplayers.de/forum/forumdisplay.php?f=101}
...
}}}

Result: Starter crashes.

Proposed solution: Consider replacing the used ini parser library by 
boost::program_options 
(http://www.boost.org/doc/libs/1_42_0/doc/html/program_options.html)

Original issue reported on code.google.com by c.anselm@paindevs.com on 19 Mar 2010 at 8:34

GoogleCodeExporter commented 9 years ago
Problem was that the storage space for the strings that are read from the ini 
file was 
statically allocated and fixed to 512 characters. Unfortunately this 
description has 
more than 512 characters and so the copy command failed - the exception was not 
catched 
and so an application crash was reported to Windows.

Solution: I replaced all relevant static-size-C-strings by STL-strings to solve 
the 
problem.

Original comment by c.anselm@paindevs.com on 19 Mar 2010 at 5:57