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

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