Ticket #1457 (closed defect: fixed)
_Stold() writes to input string on certain inputs
| Reported by: | kwl7@… | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | highest | Milestone: | 1.4.1 |
| Component: | GDAL_Raster | Version: | 1.4.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by hobu) (diff)
Using the latest SVN (and back at least as far as 1.3.2) calling _Stold() - and indirectly through CPLStrtof() - with certain ill-formatted strings will result in letters being written to that source string. For example, the following code:
char szTest[] = { '1', '.', '2', 'E', '+', '\0', 'H', 'i', '\0' };
std::cout << szTest << "\n";
CPLStrtof( szTest, NULL );
std::cout << szTest << "\n";
Will print:
1.2E+
1.2E+EHi
Where the null character at the end of the ill-formatted number is overwritten with an 'E'. I believe this happens at line 463 of cpl_strtod.cpp (in SVN). I would have included a patch, but I am not sure why that assignment is there. Hopefully you know and have some idea of how to fix it. ;)
Thanks,
Kevin
Change History
Note: See
TracTickets for help on using
tickets.
