Skip to content

Commit 0a789d6

Browse files
eschnettstevengj
andauthored
Correct out-of-bounds memory access (#311)
* Correct out-of-bounds memory access * Correct syntax error * Add test * Update NEWS.md Co-authored-by: Steven G. Johnson <stevenj@alum.mit.edu> --------- Co-authored-by: Steven G. Johnson <stevenj@alum.mit.edu>
1 parent 5e52818 commit 0a789d6

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ include (utils.cmake)
55
disallow_intree_builds()
66

77
# API version - be sure to update utf8proc.h and Makefile, too!
8-
project (utf8proc VERSION 2.11.0 LANGUAGES C)
8+
project (utf8proc VERSION 2.11.1 LANGUAGES C)
99

1010
# This is the ABI version number, which may differ from the
1111
# API version number (defined in utf8proc.h and above).
1212
# Be sure to also update these in Makefile and MANIFEST!
1313
set(SO_MAJOR 3)
1414
set(SO_MINOR 2)
15-
set(SO_PATCH 0)
15+
set(SO_PATCH 1)
1616

1717
option(UTF8PROC_INSTALL "Enable installation of utf8proc" On)
1818
option(UTF8PROC_ENABLE_TESTING "Enable testing of utf8proc" Off)

MANIFEST

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ include/
22
include/utf8proc.h
33
lib/
44
lib/libutf8proc.a
5-
lib/libutf8proc.so -> libutf8proc.so.3.2.0
6-
lib/libutf8proc.so.2 -> libutf8proc.so.3.2.0
7-
lib/libutf8proc.so.3.2.0
5+
lib/libutf8proc.so -> libutf8proc.so.3.2.1
6+
lib/libutf8proc.so.2 -> libutf8proc.so.3.2.1
7+
lib/libutf8proc.so.3.2.1
88
lib/pkgconfig/
99
lib/pkgconfig/libutf8proc.pc

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ SOFLAG = -Wl,-soname
2424
# Be sure to also update these ABI versions in MANIFEST and CMakeLists.txt!
2525
MAJOR=3
2626
MINOR=2
27-
PATCH=0
27+
PATCH=1
2828

2929
# api version (also in utf8proc.h and CMakeLists.txt)
30-
VERSION=2.11.0
30+
VERSION=2.11.1
3131

3232
OS := $(shell uname)
3333
ifeq ($(OS),Darwin) # MacOS X

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# utf8proc release history #
22

3+
## Version 2.11.1 ##
4+
5+
2025-11-04
6+
7+
- Correct out-of-bounds memory access when calling `utf8proc_map` with both `UTF8PROC_CHARBOUND` and `UTF8PROC_DECOMPOSE` ([#311]).
8+
39
## Version 2.11.0 ##
410

511
2025-09-10

test/fuzzer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
9090
utf8proc_map(data, len, &str, UTF8PROC_COMPOSE | UTF8PROC_STRIPMARK);
9191
free(str);
9292

93+
utf8proc_map(data, len, &str, UTF8PROC_CHARBOUND | UTF8PROC_DECOMPOSE);
94+
free(str);
95+
9396
return 0;
94-
}
97+
}

utf8proc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,17 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
595595
utf8proc_int32_t uc1, uc2;
596596
const utf8proc_property_t *property1, *property2;
597597
uc1 = buffer[pos];
598+
if (uc1 < 0) {
599+
/* skip grapheme break */
600+
pos++;
601+
continue;
602+
}
598603
uc2 = buffer[pos+1];
604+
if (uc2 < 0) {
605+
/* cannot recombine; skip grapheme break */
606+
pos+=2;
607+
continue;
608+
}
599609
property1 = unsafe_get_property(uc1);
600610
property2 = unsafe_get_property(uc2);
601611
if (property1->combining_class > property2->combining_class &&

utf8proc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/** The MINOR version number (increased when new functionality is added in a backwards-compatible manner). */
7474
#define UTF8PROC_VERSION_MINOR 11
7575
/** The PATCH version (increased for fixes that do not change the API). */
76-
#define UTF8PROC_VERSION_PATCH 0
76+
#define UTF8PROC_VERSION_PATCH 1
7777
/** @} */
7878

7979
#include <stdlib.h>

0 commit comments

Comments
 (0)