Also moving frame size check into read_frame_size function. Change-Id: Ib098d83bd50081bfc2941c87aea0dc58cb39583e