[Serialization] Ensure that a cached bridging header is null-terminated.

I'm not quite sure how to tickle this one, but the next commit adds more
data after the cached header, at which point existing tests break. This
could have already caused problems if no padding was needed in the bitstream.

Swift SVN r21543
This commit is contained in:
Jordan Rose
2014-08-28 21:36:00 +00:00
parent 90c76906bd
commit c3660d5ad6
2 changed files with 5 additions and 1 deletions

View File

@@ -484,8 +484,10 @@ void Serializer::writeInputFiles(FilenamesTy inputFiles,
ImportedHeader.emit(ScratchRecord, publicImportSet.count(import),
importedHeaderSize, importedHeaderModTime,
importedHeader);
if (!contents.empty())
if (!contents.empty()) {
contents.push_back('\0');
ImportedHeaderContents.emit(ScratchRecord, contents);
}
continue;
}