Avoid uninitialized memory read/compare on short reads.

Change-Id: I7537f6d22780bace6ab6da06e087a3d27da8de05
(cherry picked from commit 53db456c04ca5a1684395b60fbd6f1bed4c9c114)