Opened 17 years ago

Last modified 17 years ago

#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)

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 (4)

comment:1 by warmerdam, 17 years ago

Andrey,

Could you look this over quickly and if applicable take over this bug?

Thanks,

comment:2 by warmerdam, 17 years ago

Andrey,

Any thoughts on this?  Should I have Mateusz take care of it?



comment:3 by dron, 17 years ago

Sorry for delay with this problem, I have overlooked it. Now it should be fixed both in HEAD and 1.4 branches.

Best regards,
Andrey

comment:4 by hobu, 17 years ago

Description: modified (diff)
Milestone: 1.4.1
Version: unspecified1.4.0
Note: See TracTickets for help on using tickets.