Commit 3610f58b authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: make sure the packet size is >= 4 before checking for headers...

[media] em28xx: make sure the packet size is >= 4 before checking for headers in em28xx_urb_data_copy_vbi()
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b77e0c08
...@@ -576,7 +576,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb) ...@@ -576,7 +576,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
urb->iso_frame_desc[i].offset; urb->iso_frame_desc[i].offset;
} }
if (actual_length <= 0) { if (actual_length == 0) {
/* NOTE: happens very often with isoc transfers */ /* NOTE: happens very often with isoc transfers */
/* em28xx_usbdbg("packet %d is empty",i); - spammy */ /* em28xx_usbdbg("packet %d is empty",i); - spammy */
continue; continue;
...@@ -585,27 +585,30 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb) ...@@ -585,27 +585,30 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
/* capture type 0 = vbi start /* capture type 0 = vbi start
capture type 1 = video start capture type 1 = video start
capture type 2 = video in progress */ capture type 2 = video in progress */
if (p[0] == 0x33 && p[1] == 0x95) { len = actual_length;
dev->capture_type = 0; if (len >= 4) {
dev->vbi_read = 0; /* NOTE: headers are always 4 bytes and
em28xx_isocdbg("VBI START HEADER!!!\n"); * never split across packets */
dev->cur_field = p[2]; if (p[0] == 0x33 && p[1] == 0x95) {
p += 4; dev->capture_type = 0;
len = actual_length - 4; dev->vbi_read = 0;
} else if (p[0] == 0x88 && p[1] == 0x88 && em28xx_isocdbg("VBI START HEADER!!!\n");
p[2] == 0x88 && p[3] == 0x88) { dev->cur_field = p[2];
/* continuation */ p += 4;
p += 4; len -= 4;
len = actual_length - 4; } else if (p[0] == 0x88 && p[1] == 0x88 &&
} else if (p[0] == 0x22 && p[1] == 0x5a) { p[2] == 0x88 && p[3] == 0x88) {
/* start video */ /* continuation */
p += 4; p += 4;
len = actual_length - 4; len -= 4;
} else { } else if (p[0] == 0x22 && p[1] == 0x5a) {
/* NOTE: With bulk transfers, intermediate data packets /* start video */
* have no continuation header */ p += 4;
len = actual_length; len -= 4;
}
} }
/* NOTE: with bulk transfers, intermediate data packets
* have no continuation header */
vbi_size = dev->vbi_width * dev->vbi_height; vbi_size = dev->vbi_width * dev->vbi_height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment