Don't call memset when length is zero
Fixes this -fno-sanitize-recover=undefined check, /buffer/positions/empty: hb-buffer.cc:327:11: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/string.h:60:62: note: nonnull attribute specified here #0 0x4cf31c in hb_buffer_t::clear_positions() /home/user/code/harfbuzz/src/hb-buffer.cc:327:3 #1 0x4d4dd4 in hb_buffer_get_glyph_positions /home/user/code/harfbuzz/src/hb-buffer.cc:1418:13 #2 0x4cb553 in test_buffer_positions /home/user/code/harfbuzz/test/api/test-buffer.c:305:3 #3 0x7f324187bf49 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72f49) #4 0x7f324187be7a (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a) #5 0x7f324187be7a (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a) #6 0x7f324187c121 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73121) #7 0x7f324187c140 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73140) #8 0x4c8bd3 in hb_test_run /home/user/code/harfbuzz/test/api/./hb-test.h:88:10 #9 0x4c8bd3 in main /home/user/code/harfbuzz/test/api/test-buffer.c:884:10 #10 0x7f324086db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #11 0x41e919 in _start (/home/user/code/harfbuzz/test/api/test-buffer+0x41e919)
This commit is contained in:
parent
5a1cc199ab
commit
bfb155a5f1
|
@ -324,7 +324,8 @@ hb_buffer_t::clear_positions ()
|
||||||
out_len = 0;
|
out_len = 0;
|
||||||
out_info = info;
|
out_info = info;
|
||||||
|
|
||||||
memset (pos, 0, sizeof (pos[0]) * len);
|
if (len)
|
||||||
|
memset (pos, 0, sizeof (pos[0]) * len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue