public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com
Subject: [PATCH 7/7] Fix file size check
Date: Tue, 17 Mar 2026 11:58:02 +0200	[thread overview]
Message-ID: <20260317095802.214532-8-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20260317095802.214532-1-sakari.ailus@linux.intel.com>

The file size was unintentionally multiplied by 8 and that's not right
anymore due to changes elsewhere.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Fixes: 578f7012a851 ("Improve input validation")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 raw2rgbpnm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/raw2rgbpnm.c b/raw2rgbpnm.c
index 3b92c6ba519b..49b8071b299e 100644
--- a/raw2rgbpnm.c
+++ b/raw2rgbpnm.c
@@ -187,7 +187,7 @@ static unsigned char *read_raw_data(char *filename, unsigned int *width,
 	if (file_size % *height == 0) {
 		padding = file_size / *height - line_length;
 		printf("%u padding bytes detected at end of line\n", padding);
-	} else if ((file_size * 8) % (line_length * *height) != 0) {
+	} else if (file_size % (line_length * *height) != 0) {
 		printf("warning: input size not multiple of frame size\n");
 	}
 
-- 
2.47.3


  parent reply	other threads:[~2026-03-17  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17  9:57 [PATCH 0/7] raw2rgbpnm cleanups and a fix Sakari Ailus
2026-03-17  9:57 ` [PATCH 1/7] Reorder headers alphabetically Sakari Ailus
2026-03-17 10:50   ` Laurent Pinchart
2026-03-17  9:57 ` [PATCH 2/7] Check we have a supported format first before allocating memory Sakari Ailus
2026-03-17 10:54   ` Laurent Pinchart
2026-03-17 13:11     ` Sakari Ailus
2026-03-17  9:57 ` [PATCH 3/7] Add quotes for "-f help" in help text and do a line wrap Sakari Ailus
2026-03-17 10:54   ` Laurent Pinchart
2026-03-17  9:57 ` [PATCH 4/7] Constify progname Sakari Ailus
2026-03-17 10:54   ` Laurent Pinchart
2026-03-17  9:58 ` [PATCH 5/7] More header sorting Sakari Ailus
2026-03-17 10:54   ` Laurent Pinchart
2026-03-17  9:58 ` [PATCH 6/7] Use "stride" in a stride-related error message instead of an internal name Sakari Ailus
2026-03-17 10:55   ` Laurent Pinchart
2026-03-17  9:58 ` Sakari Ailus [this message]
2026-03-17 10:57   ` [PATCH 7/7] Fix file size check Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260317095802.214532-8-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox