Skip to content

Commit 8861a0e

Browse files
authored
Fix ASAN errors due adding offset to nullptr (#240)
* Fix ASAN errors due adding offset to nullptr * Revert "Fix ASAN errors due adding offset to nullptr" This reverts commit b933f42. * make changes compact
1 parent b2f72ca commit 8861a0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utf8proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static utf8proc_ssize_t seqindex_write_char_decomposed(utf8proc_uint16_t seqinde
388388
for (; len >= 0; entry++, len--) {
389389
utf8proc_int32_t entry_cp = seqindex_decode_entry(&entry);
390390

391-
written += utf8proc_decompose_char(entry_cp, dst+written,
391+
written += utf8proc_decompose_char(entry_cp, dst ? dst+written : dst,
392392
(bufsize > written) ? (bufsize - written) : 0, options,
393393
last_boundclass);
394394
if (written < 0) return UTF8PROC_ERROR_OVERFLOW;
@@ -578,7 +578,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
578578
uc = custom_func(uc, custom_data); /* user-specified custom mapping */
579579
}
580580
decomp_result = utf8proc_decompose_char(
581-
uc, buffer + wpos, (bufsize > wpos) ? (bufsize - wpos) : 0, options,
581+
uc, buffer ? buffer+wpos : buffer, (bufsize > wpos) ? (bufsize - wpos) : 0, options,
582582
&boundclass
583583
);
584584
if (decomp_result < 0) return decomp_result;

0 commit comments

Comments
 (0)