Commit 811a5c33 authored by Wouter van Oortmerssen's avatar Wouter van Oortmerssen

Merge pull request #274 from cogumbreiro/master

Fix an out-of bounds read when the element is bigger than the buffer.
parents 2736711d 477fedcc
...@@ -898,7 +898,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS { ...@@ -898,7 +898,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
// Verify any range within the buffer. // Verify any range within the buffer.
bool Verify(const void *elem, size_t elem_len) const { bool Verify(const void *elem, size_t elem_len) const {
return Check(elem >= buf_ && elem <= end_ - elem_len); return Check(elem_len <= (size_t) (end_ - buf_) && elem >= buf_ && elem <= end_ - elem_len);
} }
// Verify a range indicated by sizeof(T). // Verify a range indicated by sizeof(T).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment