Skip to content

Commit 5bff1be

Browse files
committed
clone inputBuffer in edge case to avoid modifying original
revert build changes
1 parent 274fa48 commit 5bff1be

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/UTF8Reader.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,17 @@ private boolean loadMore(int available) throws IOException
403403
// Bytes that need to be moved to the beginning of buffer?
404404
if (available > 0) {
405405
if (_inputPtr > 0) {
406+
if (!canModifyBuffer()) {
407+
// 15-Aug-2022, tatu: Occurs (only) if we have half-decoded UTF-8
408+
// characters; uncovered by:
409+
//
410+
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50036
411+
//
412+
// _inputBuffer needs to be cloned to avoid modifying original
413+
if (_inputSource == null) {
414+
_inputBuffer = _inputBuffer.clone();
415+
}
416+
}
406417
for (int i = 0; i < available; ++i) {
407418
_inputBuffer[i] = _inputBuffer[_inputPtr+i];
408419
}

0 commit comments

Comments
 (0)