mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Don't assert when a module file's length is not 32-bit-aligned.
This won't ever happen naturally, but by either messing with the module file or asking the compiler to load something that isn't a module at all we could end up hitting the assert. <rdar://problem/16274875> Swift SVN r14902
This commit is contained in:
@@ -85,6 +85,12 @@ SerializedModuleLoader::loadAST(Module &M, Optional<SourceLoc> diagLoc,
|
||||
bool isFramework) {
|
||||
assert(input);
|
||||
|
||||
if (input->getBufferSize() % 4 != 0) {
|
||||
if (diagLoc)
|
||||
Ctx.Diags.diagnose(*diagLoc, diag::serialization_malformed_module);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<ModuleFile> loadedModuleFile;
|
||||
ModuleStatus err = ModuleFile::load(std::move(input), loadedModuleFile,
|
||||
isFramework);
|
||||
|
||||
Reference in New Issue
Block a user