2008-05-29 20:38 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

* source/rtl/dateshb.c
   * source/rtl/datesx.c
     % Reworked to be a bit faster than non-HB_FAST_STOD.
     - Removed HB_FAST_STOD build time option, because it wasn't 
       safe. It caused reaching into undefined buffers when 
       passed string was shorter than 8 chars.
This commit is contained in:
Viktor Szakats
2008-05-29 18:39:35 +00:00
parent f4f6d4a691
commit bcd588a9f5
3 changed files with 15 additions and 11 deletions

View File

@@ -8,6 +8,14 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-05-29 20:38 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/dateshb.c
* source/rtl/datesx.c
% Reworked to be a bit faster than non-HB_FAST_STOD.
- Removed HB_FAST_STOD build time option, because it wasn't
safe. It caused reaching into undefined buffers when
passed string was shorter than 8 chars.
2008-05-29 20:20 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* source/vm/hvm.c
* Minor formatting.

View File

@@ -204,11 +204,9 @@ HB_FUNC( DTOS )
HB_FUNC( HB_STOD )
{
#ifdef HB_FAST_STOD
hb_retds( hb_parc( 1 ) );
#else
hb_retds( hb_parclen( 1 ) >= 7 ? hb_parc( 1 ) : NULL );
#endif
PHB_ITEM pDateString = hb_param( 1, HB_IT_STRING );
hb_retds( hb_itemGetCLen( pDateString ) >= 7 ? hb_itemGetCPtr( pDateString ) : NULL );
}
HB_FUNC( YEAR )

View File

@@ -51,6 +51,7 @@
*/
#include "hbapi.h"
#include "hbapiitm.h"
#ifdef HB_COMPAT_XPP
@@ -59,12 +60,9 @@
HB_FUNC( STOD )
{
#ifdef HB_FAST_STOD
hb_retds( hb_parc( 1 ) );
#else
hb_retds( hb_parclen( 1 ) >= 7 ? hb_parc( 1 ) : NULL );
#endif
PHB_ITEM pDateString = hb_param( 1, HB_IT_STRING );
hb_retds( hb_itemGetCLen( pDateString ) >= 7 ? hb_itemGetCPtr( pDateString ) : NULL );
}
#endif