Ticket #1457 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

_Stold() writes to input string on certain inputs

Reported by: kwl7@cornell.edu Assigned to: 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

01/23/07 21:38:15 changed by warmerdam

Andrey,

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

Thanks,

03/11/07 15:25:44 changed by warmerdam

Andrey,

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



03/13/07 08:34:50 changed by dron

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

03/25/07 20:36:40 changed by hobu

  • version changed from unspecified to 1.4.0.
  • description changed.
  • milestone set to 1.4.1.