Skip to content

Commit aad2f4c

Browse files
committed
resize output if error
1 parent 2a8da8e commit aad2f4c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Support/CharSet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ CharSetConverterICU::convert(StringRef Source,
161161
continue;
162162
}
163163
// Some other error occured.
164+
Result.resize(Output - Result.data());
164165
return std::error_code(EILSEQ, std::generic_category());
165166
}
166167
break;
@@ -227,6 +228,7 @@ CharSetConverterIconv::convert(StringRef Source,
227228
return std::error_code();
228229
} else {
229230
// Some other error occured.
231+
Result.resize(Output - Result.data());
230232
return std::error_code(errno, std::generic_category());
231233
}
232234
} else {

0 commit comments

Comments
 (0)