Re: aplay weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay,


On 2018-08-31 01:42, Jay Foster wrote:
What version of aplay?


alsa-utils-1.1.6-1.fc28.x86_64


If it is version 1.1.6, you might be running
into this issue:
From: Takashi Iwai <tiwai@xxxxxxx>
Subject: [PATCH] aplay: Fix invalid file size check for non-regular
files


Looks like you nailed it - so I will have to build my own I guess . .

Thanks!

P.


aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size.  This works fine for regular files, but when a special file like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.

A proper fix is to do this sanity check only for a regular file.

Reported-by: Jay Foster <jay@xxxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 aplay/aplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index bbd7fffa04fc..63ec9efbebc1 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int
header_size)

     /* don't be adventurous, get out if file size is smaller than
      * requested header size */
-    if (buf.st_size < header_size)
+    if ((buf.st_mode & S_IFMT) == S_IFREG &&
+        buf.st_size < header_size)
         return -1;

     if (*loaded < header_size) {

Jay

On 8/30/2018 2:50 AM, Philip Rhoades wrote:

People,

This produces a crashing static sound:

espeak --stdout 'words to speak' | aplay

but this works as expected:

espeak --stdout 'words to speak' > ./t
aplay ./t

What is wrong with the first command?

Thanks,

Phil.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  phil@xxxxxxxxxxxxx

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux