libv4lconvert: Fix a regression when converting from Y10B
authorAntonio Ospite <ao2@ao2.it>
Mon, 16 Jun 2014 15:00:41 +0000 (17:00 +0200)
committerHans de Goede <hdegoede@redhat.com>
Wed, 18 Jun 2014 11:43:59 +0000 (13:43 +0200)
commitfff7e0eaae9734aa1f0a4e0fadef0d8c5c41b1e8
tree091dc9b0b9f3f038ec06adb441b8c7fdc10e3be9
parent566266878ee835fdbb8170f5d95b04f1219b8c22
libv4lconvert: Fix a regression when converting from Y10B

Fix a regression introduced in commit
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 (libv4lconvert: Reject too
short source buffer before accessing it).

The old code:

case V4L2_PIX_FMT_Y10BPACK:
...
if (result == 0 && src_size < (width * height * 10 / 8)) {
V4LCONVERT_ERR("short y10b data frame\n");
errno = EPIPE;
result = -1;
}
...

meant to say "If the conversion was *successful* _but_ the frame size
was invalid, then take the error path", but in
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 this (maybe weird) logic was
misunderstood and v4lconvert_convert_pixfmt() was made to return an
error even in the case of a successful conversion from Y10B.

Drop the no longer needed second check to fix this.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
lib/libv4lconvert/libv4lconvert.c