https://gitlab.synchro.net/main/sbbs/-/commit/7081a525902dcc4acf4f00a2
Modified Files:
src/xpdev/genwrap.c
Log Message:
Fix mysterious double overflow issue in parse_byte_count()It's possible that some values (e.g. "16384P") exceed the storage (count ofbytes) of a 64-bit integer, and such values were causing floating pointexceptions when running sbbsctrl.exe, e.g.Faulting application name: sbbsctrl.exe, version: 3.20.0.0, time stamp:0x00000000Faulting module name: gdi32full.dll, version: 10.0.19041.2604, time stamp:0x2b5302d5Exception code: 0xc0000090but interesting
(and perhaps a clue), not with sbbs.exe.Anyway, this added range checking, limiting the maximum value to INT64_MAX(after division by unit, though there was no division-unit in the problemcase, the "min_dspace" value parsing in scfglib2.c). Using conditional/ternaryreturn statement had the same floating point exception occurrences, so thisif-statement shouldn't be removed/changed/optimized!I suspect this has something to do with mix of Borland and MSVC run-time libsand perhaps different expectations or setups with
regards to floating pointexceptions. I did notice that when stepping through read_file_cfg(), I wouldget different return values for the same call to iniGetBytes() depending onwhether it was initiated from sbbsctrl.exe (built with C++Builder) orsbbs.dll (built with MSVC).Thanks to Codefenix for providing
the sample file.ini file that demonstratedthe issue. This problem would've been
very hard to root-cause otherwise!
--- SBBSecho 3.20-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)