Skip to content

Commit

Permalink
Fix next_code_point<char16_t>; #576
Browse files Browse the repository at this point in the history
  • Loading branch information
the-moisrex committed Dec 24, 2024
1 parent 31e713a commit 03e0297
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
8 changes: 8 additions & 0 deletions gdb/2024-12-unicode-fuzz-tests.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source ../gdb/functions.gdb

delete breakpoints
chain tests/unicode_test.cpp:6943
chain tests/unicode_fuzz.hpp:29
chain webpp/unicode/normalization.hpp:697
chain webpp/unicode/normalization.hpp:442

23 changes: 23 additions & 0 deletions gdb/functions.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set $bpstart = $bpnum ? $bpnum : 0
set breakpoint pending on

define chain
break $arg0

set $distance = $bpnum - $bpstart

commands $bpnum
set $nextbp = $_hit_bpnum + 1
set $chain_num = $_hit_bpnum - $bpstart
printf "\nWe're at breakpoint number %d of the chain\n", $chain_num
printf "Enabling breakpoint: %d\n\n", $nextbp
enable once $nextbp
end

# don't disable the first one
if $distance > 1
printf "Distabling: %d\n", $bpnum
disable $bpnum
end
end

4 changes: 3 additions & 1 deletion webpp/unicode/unicode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,9 @@ namespace webpp::unicode {
code_point += 0x1'0000U;
}
if (error || is_surrogate(code_point)) [[unlikely]] {
--pos;
if (requires_2_units) {
--pos;
}
code_point = cu1;
break;
}
Expand Down

0 comments on commit 03e0297

Please sign in to comment.