From 59e83892e0a029a5d773c8d0a835d471df3ccfd2 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 3 May 2017 05:34:00 +0000 Subject: Fix use after free in BinaryStream library. This was reported by the ASAN bot, and it turned out to be a fairly fundamental problem with the design of VarStreamArray and the way it passes context information to the extractor. The fix was cumbersome, and I'm not entirely pleased with it, so I plan to revisit this design in the future when I'm not pressed to get the bots green again. For now, this fixes the issue by storing the context information by value instead of by reference, and introduces some impossibly-confusing template magic to make things "work". llvm-svn: 301999 --- llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp') diff --git a/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp b/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp index c349e7ecce9..87763248391 100644 --- a/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp +++ b/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp @@ -25,7 +25,7 @@ struct FileChecksumEntryHeader { }; Error llvm::VarStreamArrayExtractor::extract( - BinaryStreamRef Stream, uint32_t &Len, FileChecksumEntry &Item, void *Ctx) { + BinaryStreamRef Stream, uint32_t &Len, FileChecksumEntry &Item) { BinaryStreamReader Reader(Stream); const FileChecksumEntryHeader *Header; -- cgit v1.2.3