Blame SOURCES/alsa-utils-1.1.6-post.patch

11a420
From da4d5bd53a1a57d1b39318b83d3280fbcd78e9f6 Mon Sep 17 00:00:00 2001
11a420
From: Takashi Iwai <tiwai@suse.de>
11a420
Date: Tue, 15 May 2018 22:17:01 +0200
11a420
Subject: [PATCH] aplay: Fix invalid file size check for non-regular files
11a420
11a420
aplay tries to check the file size via fstat() at parsing the format
11a420
headers and avoids parsing when the size is shorter than the given
11a420
size.  This works fine for regular files, but when a special file like
11a420
pipe is passed, it fails, eventually leading to the fallback mode
11a420
wrongly.
11a420
11a420
A proper fix is to do this sanity check only for a regular file.
11a420
11a420
Reported-by: Jay Foster <jay@systech.com>
11a420
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11a420
---
11a420
 aplay/aplay.c | 3 ++-
11a420
 1 file changed, 2 insertions(+), 1 deletion(-)
11a420
11a420
diff --git a/aplay/aplay.c b/aplay/aplay.c
11a420
index bbd7fff..63ec9ef 100644
11a420
--- a/aplay/aplay.c
11a420
+++ b/aplay/aplay.c
11a420
@@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int header_size)
11a420
 
11a420
 	/* don't be adventurous, get out if file size is smaller than
11a420
 	 * requested header size */
11a420
-	if (buf.st_size < header_size)
11a420
+	if ((buf.st_mode & S_IFMT) == S_IFREG &&
11a420
+	    buf.st_size < header_size)
11a420
 		return -1;
11a420
 
11a420
 	if (*loaded < header_size) {
11a420
-- 
11a420
2.13.6
11a420