Skip to content

Commit 66b2285

Browse files
author
Marcin Sobieszczanski
committed
fix out of memory reference in utf16_to_utf8
1 parent c74fb29 commit 66b2285

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hdr/sqlite_modern_cpp/utility/utf16_utf8.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace sqlite {
1717
std::size_t produced_output = 0;
1818
while(true) {
1919
char *used_output;
20-
switch(codecvt.out(state, remaining_input, &input[input.size()],
20+
switch(codecvt.out(state, remaining_input, input.data() + input.size(),
2121
remaining_input, &result[produced_output],
2222
&result[result.size() - 1] + 1, used_output)) {
2323
case std::codecvt_base::ok:
@@ -33,7 +33,7 @@ namespace sqlite {
3333
produced_output = used_output - result.data();
3434
result.resize(
3535
result.size()
36-
+ (std::max)((&input[input.size()] - remaining_input) * 3 / 2,
36+
+ (std::max)((input.data() + input.size() - remaining_input) * 3 / 2,
3737
std::ptrdiff_t(4)));
3838
}
3939
}

0 commit comments

Comments
 (0)