Even if it's length prefixed, the logic here basically just consumes the entire buffer, which doesn't seem right<br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 9, 2016 at 5:43 PM Adrian McCarthy <<a href="mailto:amccarth@google.com">amccarth@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">amccarth added inline comments.<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:21<br class="gmail_msg">
@@ +20,3 @@<br class="gmail_msg">
+llvm::StringRef<br class="gmail_msg">
+lldb_private::minidump::consumeString(llvm::ArrayRef<uint8_t> &Buffer) {<br class="gmail_msg">
+ return llvm::StringRef(reinterpret_cast<const char *>(Buffer.data()),<br class="gmail_msg">
----------------<br class="gmail_msg">
zturner wrote:<br class="gmail_msg">
> labath wrote:<br class="gmail_msg">
> > This is not consistent with the consumeObject function, which also drops the consumed bytes from the buffer.<br class="gmail_msg">
> Is this logic correct? A buffer may be arbitrarily large and have more data in it besides the string. Perhaps you need to search forward for a null terminator, then only return that portion of the string, then drop that many bytes (plus the null terminator) from the input buffer?<br class="gmail_msg">
Minidump strings aren't zero-terminated. They're counted (in UTF16 code units). So this would have to read the count and "consume" the appropriate number of bytes.<br class="gmail_msg">
<br class="gmail_msg">
Oh, but this isn't used for minidump strings. It looks like it's for these Linux proc status fields.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D24385" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D24385</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>