Fix a bug that would cause OoB memory read. am: a6c9ad41f7 am: e19472c066 am: 628e78b390 am: ab84f1361f

Change-Id: I3ca1e291e5b3c44ea5b4db2983581a266818c88a