[PATCH] D26638: Don't pass nullptr into memcpy
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 14:37:46 PST 2016
Majnemer, I don't follow. If Data.size() > 0 and Buffer.size() == 0, then
the old code would fail the first check "Data.size() < Buffer.size()" and
the second check "Offset > Buffer.size() - Data.size()" (this would
actually overflow since Buffer.size() would be 0).
So then it would memcpy with a size of 0 and return Error::success().
Where are you seeing that it returns insufficient_buffer?
Now it just immediately returns success if you're attempting to write
nothing, which seems right to me.
On Mon, Nov 14, 2016 at 2:27 PM David Majnemer <david.majnemer at gmail.com>
wrote:
> majnemer added a comment.
>
> Did this get an LGTM? This change doesn't look right. The old code would
> return `msf_error_code::insufficient_buffer` if `Data.size()` was greater
> than zero.
>
>
> Repository:
> rL LLVM
>
> https://reviews.llvm.org/D26638
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161114/1bb9287c/attachment.html>
More information about the llvm-commits
mailing list