Fix debug output.

If we have fewer bytes left in the buffer than
the output alignment, we would read out of bounds
and output (partially) incorrect data.

Test: debug output is correct
(cherry picked from commit 0d9dda2b69c47707e9fdf39d68b04b8edf5623ef)
Bug: 129785390
Change-Id: I66913c58295ccd8e1955a73a17f6eed45ca6cd1e
1 file changed