Merge pull request #9738 from davidflanagan/bug865772

Bug 865772 - check blob size before reading bytes from it r=dhylands(cherry picked from commit 9ea3fee276439300e6d3f43460ef88ac45417fca)
Merge pull request #9856 from davidflanagan/865772-v1-train

Merge pull request #9738 from davidflanagan/bug865772