Fix StreamingMemoryObject to respect known object size.
authorDerek Schuff <dschuff@google.com>
Thu, 21 May 2015 19:40:19 +0000 (19:40 +0000)
committerDerek Schuff <dschuff@google.com>
Thu, 21 May 2015 19:40:19 +0000 (19:40 +0000)
commit493bc7e30090915290a8f08fbeba02f3d912498e
tree4ae7d82e21b40cef395c1e37b22a16f96dc556b6
parentad7c1174c70a26e547f7dc6f852664b1141f7453
Fix StreamingMemoryObject to respect known object size.

The existing code for method StreamingMemoryObject.fetchToPos does not respect
the corresonding call to setKnownObjectSize(). As a result, it allows the
StreamingMemoryObject to read bytes past the object size.

This patch provides a test case, and code to fix the problem.

Patch by Karl Schimpf
Differential Revision: http://reviews.llvm.org/D8931

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237939 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/StreamingMemoryObject.h
lib/Support/StreamingMemoryObject.cpp
unittests/Support/StreamingMemoryObject.cpp