- t = bytestream_get_byte(&buf);
- if(!t){ //raw block
- for(y = 0; y < 4; y++)
- memcpy(cur + y*width, buf + y*4, 4);
- buf += 16;
- }else{ // motion compensation
+ t = bytestream2_get_byte(&g);
+ if (!t) { //raw block
+ if (bytestream2_get_bytes_left(&g) < 16) {
+ av_log(c->avctx, AV_LOG_ERROR, "Insufficient data\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (y = 0; y < 4; y++)
+ bytestream2_get_buffer(&g, cur + y * width, 4);
+ } else { // motion compensation