a bad call to memcpy.
When we only have a buffer from one of the two reparse calls, we can
just return that buffer rather than going through the realloc/memcpy
dance.
Found with UBsan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243950
91177308-0d34-0410-b5e6-
96231b3b80d8
if (ret)
return ret;
+ if (num_unsaved_files_no_try_idx == 0) {
+ *unsaved_files = unsaved_files_try_idx;
+ *num_unsaved_files = num_unsaved_files_try_idx;
+ return 0;
+ }
+ if (num_unsaved_files_try_idx == 0) {
+ *unsaved_files = unsaved_files_no_try_idx;
+ *num_unsaved_files = num_unsaved_files_no_try_idx;
+ return 0;
+ }
+
*num_unsaved_files = num_unsaved_files_no_try_idx + num_unsaved_files_try_idx;
*unsaved_files
= (struct CXUnsavedFile *)realloc(unsaved_files_no_try_idx,