diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-09-20 09:57:11 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-09-20 09:57:11 +0000 |
| commit | cefe7e1142c082816dc3da743e4be45a2fdfe723 (patch) | |
| tree | 5ce18fc0ca04e5f9c8604b43035e7b89faa6f6ac /llvm/include | |
| parent | b0f0a1ea03b55df2c0fcd7e7d56006b7a849124b (diff) | |
| download | bcm5719-llvm-cefe7e1142c082816dc3da743e4be45a2fdfe723.tar.gz bcm5719-llvm-cefe7e1142c082816dc3da743e4be45a2fdfe723.zip | |
[yaml2obj] - Don't crash on invalid document.
Previously jaml2obj would segfault on empty document.
(without yaml description).
Patch fixes the issue.
Differential revision: https://reviews.llvm.org/D38036
llvm-svn: 313746
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Support/YAMLTraits.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 71fdf47f197..5f6f0493e28 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -1418,8 +1418,8 @@ inline typename std::enable_if<has_MappingTraits<T, EmptyContext>::value, Input &>::type operator>>(Input &yin, T &docMap) { EmptyContext Ctx; - yin.setCurrentDocument(); - yamlize(yin, docMap, true, Ctx); + if (yin.setCurrentDocument()) + yamlize(yin, docMap, true, Ctx); return yin; } |

