From 2c2e0c184f0d0a61f686a4e4477afb19874733c8 Mon Sep 17 00:00:00 2001 From: Parmeet Singh Bhatia Date: Thu, 9 Jun 2022 16:39:32 -0400 Subject: [PATCH] Revert "Fix ASAN errors due adding offset to nullptr" This reverts commit b933f42d51e6a8e278e6ce1932e6e027e07d5f51. --- utf8proc.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/utf8proc.c b/utf8proc.c index d41f570..6752a55 100644 --- a/utf8proc.c +++ b/utf8proc.c @@ -365,16 +365,9 @@ static utf8proc_ssize_t seqindex_write_char_decomposed(utf8proc_uint16_t seqinde for (; len >= 0; entry++, len--) { utf8proc_int32_t entry_cp = seqindex_decode_entry(&entry); - if (!dst){ - written += utf8proc_decompose_char(entry_cp, dst, - (bufsize > written) ? (bufsize - written) : 0, options, - last_boundclass); - }else{ - written += utf8proc_decompose_char(entry_cp, dst+written, - (bufsize > written) ? (bufsize - written) : 0, options, - last_boundclass); - } - + written += utf8proc_decompose_char(entry_cp, dst+written, + (bufsize > written) ? (bufsize - written) : 0, options, + last_boundclass); if (written < 0) return UTF8PROC_ERROR_OVERFLOW; } return written; @@ -557,18 +550,10 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom( if (custom_func != NULL) { uc = custom_func(uc, custom_data); /* user-specified custom mapping */ } - if (!buffer){ - decomp_result = utf8proc_decompose_char( - uc, buffer, (bufsize > wpos) ? (bufsize - wpos) : 0, options, - &boundclass - ); - }else{ - decomp_result = utf8proc_decompose_char( - uc, buffer + wpos, (bufsize > wpos) ? (bufsize - wpos) : 0, options, - &boundclass - ); - } - + decomp_result = utf8proc_decompose_char( + uc, buffer + wpos, (bufsize > wpos) ? (bufsize - wpos) : 0, options, + &boundclass + ); if (decomp_result < 0) return decomp_result; wpos += decomp_result; /* prohibiting integer overflows due to too long strings: */