Re-casting with tmp the uint8_t* pData pointer to uint16_t* brings a memory corruption and typically can corrupt the size parameter. This is fixed with this commit. STM32 Internal ticket reference : 39116