swiftlang/swift

[SR-8706] Fix up parseDependencyFile to not crash on invalid YAML

开放

#51,218 创建于 2018年9月5日

 (1 条评论) (0 个反应) (0 位负责人)Swift (10,719 个派生)batch import
bugcompilergood first issuelegacy driver

仓库指标

星标
 (69,989 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Previous ID SR-8706
Radar rdar://problem/25095498
Original Reporter @belkadan
Type Bug
Votes 0
Component/s Compiler
Labels Bug, Driver, StarterBug
Assignee kushaj (JIRA)
Priority Medium

md5: dfcb979cb9d3bef3f8ec210cda836a79

relates to:

  • SR-8707 Write out swiftdeps files atomically

Issue Description:

LLVM's YAML parser returns null when it encounters a malformed node, but parseDependencyFile (in DependencyFile.cpp) isn't checking for this. We should fix this so that a malformed "swiftdeps" file doesn't result in crashes.

This applies to all uses of the LLVM YAML parser, really:

  • OutputFileMap::parse in OutputFileMap.cpp

  • populateOutOfDateMap in Driver.cpp

  • YamlGroupInputParser in Serialization.cpp already seems to be doing this correctly.

  • APIDiffItemStore and SILPassPipelinePlan::getPassPipelineFromFile don't really have to care about malformed input.

Tests for these APIs can go into the unittests/Driver/ folder.

贡献者指南