The patch number 12022 was added via [email protected]
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <[email protected]>

------

From: Hans de Goede  <[email protected]>
libv4l: fix reading wrong memory when doing yuv420->rgb conversion


Fix reading outside of the source memory when doing yuv420->rgb conversion.

Priority: normal

Signed-off-by: Hans de Goede <[email protected]>


---

 v4l2-apps/libv4l/ChangeLog              |    1 +
 v4l2-apps/libv4l/libv4l2/log.c          |   12 ++++++------
 v4l2-apps/libv4l/libv4lconvert/rgbyuv.c |    4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff -r d866645245ee -r d2eca763deba v4l2-apps/libv4l/ChangeLog
--- a/v4l2-apps/libv4l/ChangeLog        Tue Apr 14 15:03:07 2009 +0200
+++ b/v4l2-apps/libv4l/ChangeLog        Tue Apr 14 16:49:43 2009 +0200
@@ -24,6 +24,7 @@ libv4l-0.5.97
 * adjust libv4l's upside down cam detection to also work with devices
   which have the usb interface as parent instead of the usb device
 * fix libv4l upside down detection for the new v4l minor numbering scheme
+* fix reading outside of the source memory when doing yuv420->rgb conversion
 
 libv4l-0.5.9
 ------------
diff -r d866645245ee -r d2eca763deba v4l2-apps/libv4l/libv4l2/log.c
--- a/v4l2-apps/libv4l/libv4l2/log.c    Tue Apr 14 15:03:07 2009 +0200
+++ b/v4l2-apps/libv4l/libv4l2/log.c    Tue Apr 14 16:49:43 2009 +0200
@@ -163,7 +163,7 @@ void v4l2_log_ioctl(unsigned long int re
        struct v4l2_frmsizeenum *frmsize = arg;
        int pixfmt = frmsize->pixel_format;
 
-       fprintf(v4l2_log_file, "  index: %u pixelformat: %c%c%c%c",
+       fprintf(v4l2_log_file, "  index: %u pixelformat: %c%c%c%c\n",
          frmsize->index,
          pixfmt & 0xff,
          (pixfmt >> 8) & 0xff,
@@ -171,12 +171,12 @@ void v4l2_log_ioctl(unsigned long int re
          pixfmt >> 24);
        switch (frmsize->type) {
          case V4L2_FRMSIZE_TYPE_DISCRETE:
-           fprintf(v4l2_log_file, " %ux%u\n", frmsize->discrete.width,
+           fprintf(v4l2_log_file, "  %ux%u\n", frmsize->discrete.width,
              frmsize->discrete.height);
            break;
          case V4L2_FRMSIZE_TYPE_CONTINUOUS:
          case V4L2_FRMSIZE_TYPE_STEPWISE:
-           fprintf(v4l2_log_file, " %ux%u -> %ux%u\n",
+           fprintf(v4l2_log_file, "  %ux%u -> %ux%u\n",
              frmsize->stepwise.min_width, frmsize->stepwise.min_height,
              frmsize->stepwise.max_width, frmsize->stepwise.max_height);
            break;
@@ -188,7 +188,7 @@ void v4l2_log_ioctl(unsigned long int re
        struct v4l2_frmivalenum *frmival = arg;
        int pixfmt = frmival->pixel_format;
 
-       fprintf(v4l2_log_file, "  index: %u pixelformat: %c%c%c%c %ux%u: ",
+       fprintf(v4l2_log_file, "  index: %u pixelformat: %c%c%c%c %ux%u:\n",
          frmival->index,
          pixfmt & 0xff,
          (pixfmt >> 8) & 0xff,
@@ -198,12 +198,12 @@ void v4l2_log_ioctl(unsigned long int re
          frmival->height);
        switch (frmival->type) {
          case V4L2_FRMIVAL_TYPE_DISCRETE:
-           fprintf(v4l2_log_file, "%u/%u\n", frmival->discrete.numerator,
+           fprintf(v4l2_log_file, "  %u/%u\n", frmival->discrete.numerator,
              frmival->discrete.denominator);
            break;
          case V4L2_FRMIVAL_TYPE_CONTINUOUS:
          case V4L2_FRMIVAL_TYPE_STEPWISE:
-           fprintf(v4l2_log_file, "%u/%u -> %u/%u\n",
+           fprintf(v4l2_log_file, "  %u/%u -> %u/%u\n",
              frmival->stepwise.min.numerator,
              frmival->stepwise.min.denominator,
              frmival->stepwise.max.numerator,
diff -r d866645245ee -r d2eca763deba v4l2-apps/libv4l/libv4lconvert/rgbyuv.c
--- a/v4l2-apps/libv4l/libv4lconvert/rgbyuv.c   Tue Apr 14 15:03:07 2009 +0200
+++ b/v4l2-apps/libv4l/libv4lconvert/rgbyuv.c   Tue Apr 14 16:49:43 2009 +0200
@@ -135,7 +135,7 @@ void v4lconvert_yuv420_to_bgr24(const un
       vsrc++;
     }
     /* Rewind u and v for next line */
-    if (i&1) {
+    if (!(i&1)) {
       usrc -= width / 2;
       vsrc -= width / 2;
     }
@@ -189,7 +189,7 @@ void v4lconvert_yuv420_to_rgb24(const un
       vsrc++;
     }
     /* Rewind u and v for next line */
-    if (i&1) {
+    if (!(i&1)) {
       usrc -= width / 2;
       vsrc -= width / 2;
     }


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/d2eca763debaecbfd1d2ed283931b0351b75fe9c

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to