[llvm] r193737 - Fix a use after free on invalid input.

Reid Kleckner rnk at google.com
Thu Oct 31 12:02:54 PDT 2013


This test will fail when someone adds a new attribute, like inalloca.  I'm
going to move the invalid attribute bitcode out to 48 instead of just 38.


On Wed, Oct 30, 2013 at 9:20 PM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:

> Author: rafael
> Date: Wed Oct 30 23:20:23 2013
> New Revision: 193737
>
> URL: http://llvm.org/viewvc/llvm-project?rev=193737&view=rev
> Log:
> Fix a use after free on invalid input.
>
> Added:
>     llvm/trunk/test/Bitcode/invalid.ll
>     llvm/trunk/test/Bitcode/invalid.ll.bc
> Modified:
>     llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
>
> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=193737&r1=193736&r2=193737&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Oct 30 23:20:23
> 2013
> @@ -623,11 +623,7 @@ bool BitcodeReader::ParseAttrKind(uint64
>      *Kind = Attribute::ZExt;
>      return false;
>    default:
> -    std::string Buf;
> -    raw_string_ostream fmt(Buf);
> -    fmt << "Unknown attribute kind (" << Code << ")";
> -    fmt.flush();
> -    return Error(Buf.c_str());
> +    return Error("Unknown attribute kind");
>    }
>  }
>
>
> Added: llvm/trunk/test/Bitcode/invalid.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll?rev=193737&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Bitcode/invalid.ll (added)
> +++ llvm/trunk/test/Bitcode/invalid.ll Wed Oct 30 23:20:23 2013
> @@ -0,0 +1,7 @@
> +; RUN:  not llvm-dis < %s.bc 2>&1 | FileCheck %s
> +
> +; CHECK: llvm-dis: Unknown attribute kind
> +
> +; invalid.ll.bc has an invalid attribute number.
> +; The test checks that LLVM reports the error and doesn't access freed
> memory
> +; in doing so.
>
> Added: llvm/trunk/test/Bitcode/invalid.ll.bc
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll.bc?rev=193737&view=auto
>
> ==============================================================================
> Binary files llvm/trunk/test/Bitcode/invalid.ll.bc (added) and
> llvm/trunk/test/Bitcode/invalid.ll.bc Wed Oct 30 23:20:23 2013 differ
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131031/f90054b2/attachment.html>


More information about the llvm-commits mailing list