From aa54fe630fac60bf700d7ddd7f8dda197d961404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Thu, 4 Dec 2025 16:39:21 +0100 Subject: [PATCH] 2025-12-04 16:39 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/cdpapi.c ! fixed hb_cdpUTF8StringPeek() to work with 0 based indexes and Unicode characters > 0xFFFF * src/rtl/hbmd5.c ! removed redundant code (copy and past typo) --- ChangeLog.txt | 8 ++++++++ src/rtl/cdpapi.c | 8 ++++---- src/rtl/hbmd5.c | 8 -------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ee39ca2028..fc779fc9c8 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,14 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2025-12-04 16:39 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/rtl/cdpapi.c + ! fixed hb_cdpUTF8StringPeek() to work with 0 based indexes and + Unicode characters > 0xFFFF + + * src/rtl/hbmd5.c + ! removed redundant code (copy and past typo) + 2025-11-22 12:40 UTC+0100 Aleksander Czajczynski (hb fki.pl) * include/hbdefs.h ! fix undefined behaviour on signed int overflow in diff --git a/src/rtl/cdpapi.c b/src/rtl/cdpapi.c index 3aa5c396f2..97a43eba68 100644 --- a/src/rtl/cdpapi.c +++ b/src/rtl/cdpapi.c @@ -1505,11 +1505,11 @@ HB_WCHAR32 hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos ) { HB_SIZE nIndex = 0; - while( nPos && nIndex < nLen ) + while( nIndex < nLen ) { - HB_WCHAR wc; - hb_cdpUTF8GetU16( pSrc, nLen, &nIndex, &wc ); - if( --nPos == 0 ) + HB_WCHAR32 wc; + hb_cdpUTF8GetU32( pSrc, nLen, &nIndex, &wc ); + if( nPos-- == 0 ) return wc; } return 0; diff --git a/src/rtl/hbmd5.c b/src/rtl/hbmd5.c index 9bb538fbbe..18f925dd6b 100644 --- a/src/rtl/hbmd5.c +++ b/src/rtl/hbmd5.c @@ -417,14 +417,6 @@ HB_FUNC( HB_MD5 ) /* Considered insecure. Use SHA256 or higher instead. */ } else hb_retclen( dststr, HB_SIZEOFARRAY( dststr ) ); - if( ! hb_parl( 2 ) ) - { - char digest[ ( sizeof( dststr ) * 2 ) + 1 ]; - hb_strtohex( dststr, sizeof( dststr ), digest ); - hb_retclen( digest, HB_SIZEOFARRAY( digest ) - 1 ); - } - else - hb_retclen( dststr, HB_SIZEOFARRAY( dststr ) ); } else hb_retc_null(); /* return empty string on wrong call */