[PATCH] Add test showing error in StreamingMemoryObject.setKnownObjectSize().

Karl Schimpf kschimpf at google.com
Mon Apr 13 10:09:58 PDT 2015


================
Comment at: include/llvm/Support/StreamingMemoryObject.h:84
@@ -79,3 +83,3 @@
     }
-    return Pos < BytesRead;
+    return (Pos < BytesRead) || (ObjectSize && Pos < ObjectSize);
   }
----------------
rafael wrote:
> I still don't get it. 
> 
> The comment says
> 
> Returns true if Pos can be read.
> 
> Now , assume you start reading a bitcode file over http. You get the header of the wrapper saying the size and ObjectSize is set.
> After that  your network connection goes down and GetBytes will fail to read more data.
> 
> fetchToPos will incorrectly say that Pos can be read, no?
> 
Good point. I didn't deal with that case. I only dealt with the case where BytesRead was larger than ObjectSize.

Fixing so that both cases are handled.

http://reviews.llvm.org/D8931

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list