opj_t2_encode_packet(): fix potential write heap buffer overflow (#992)