Validate readByteArrayAsData size

Check that the reader has enough data before attempting to allocate the
buffer.

Also update to return nullptr on read failures.

Change-Id: Ia1ea8f611bad95cf3a4493b12582ac3fa7c2b00f
Reviewed-on: https://skia-review.googlesource.com/127129
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
6 files changed