[llvm] r303408 - Don't crash if someone tries to visit an empty type stream.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 11:53:40 PDT 2017


Test case?

On Thu, May 18, 2017 at 10:31 PM Zachary Turner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: zturner
> Date: Fri May 19 00:18:09 2017
> New Revision: 303408
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303408&view=rev
> Log:
> Don't crash if someone tries to visit an empty type stream.
>
> Modified:
>     llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp?rev=303408&r1=303407&r2=303408&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp Fri May 19
> 00:18:09 2017
> @@ -227,6 +227,9 @@ Error CVTypeVisitor::visitTypeStream(CVT
>  }
>
>  Error CVTypeVisitor::visitTypeStream(TypeCollection &Types) {
> +  if (Types.empty())
> +    return Error::success();
> +
>    Optional<TypeIndex> I = Types.getFirst();
>    do {
>      CVType Type = Types.getType(*I);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170522/fbe1995e/attachment.html>


More information about the llvm-commits mailing list