mask.c: fixed stretch_mask buffer overflow bug