From patchwork Wed Dec 15 16:11:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 413841 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBFGC0Oq016346 for ; Wed, 15 Dec 2010 16:12:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871Ab0LOQL7 (ORCPT ); Wed, 15 Dec 2010 11:11:59 -0500 Received: from smtp209.alice.it ([82.57.200.105]:47287 "EHLO smtp209.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778Ab0LOQL6 (ORCPT ); Wed, 15 Dec 2010 11:11:58 -0500 Received: from jcn (82.61.82.13) by smtp209.alice.it (8.5.124.08) (authenticated as fospite@alice.it) id 4C1A27590CBB9451 for linux-media@vger.kernel.org; Wed, 15 Dec 2010 17:11:57 +0100 Date: Wed, 15 Dec 2010 17:11:39 +0100 From: Antonio Ospite To: linux-media@vger.kernel.org Subject: Question about libv4lconvert. Message-Id: <20101215171139.b6c1f03a.ospite@studenti.unina.it> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Dec 2010 16:12:02 +0000 (UTC) diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index 26a0978..46e6500 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -854,7 +854,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, if (src_size < (width * height)) { V4LCONVERT_ERR("short grey data frame\n"); errno = EPIPE; - result = -1; + return -1; } break; case V4L2_PIX_FMT_RGB565: And: diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index 46e6500..a1a4858 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -841,6 +841,11 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, break; case V4L2_PIX_FMT_GREY: + if (src_size < (width * height)) { + V4LCONVERT_ERR("short grey data frame\n"); + errno = EPIPE; + return -1; + } switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_BGR24: @@ -851,11 +856,6 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, v4lconvert_grey_to_yuv420(src, dest, fmt); break; } - if (src_size < (width * height)) { - V4LCONVERT_ERR("short grey data frame\n"); - errno = EPIPE; - return -1; - } break; case V4L2_PIX_FMT_RGB565: switch (dest_pix_fmt) {