File: sox.patch

package info (click to toggle)
pytorch-audio 0.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,592 kB
  • sloc: python: 41,137; cpp: 8,016; sh: 3,538; makefile: 24
file content (16 lines) | stat: -rw-r--r-- 493 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
See https://github.com/pytorch/audio/pull/1297
diff -ru sox/src/formats.c sox/src/formats.c
--- sox/src/formats.c	2014-10-26 19:55:50.000000000 -0700
+++ sox/src/formats.c	2021-02-22 16:01:02.833144070 -0800
@@ -333,6 +333,10 @@
   assert(ft);
   if (!ft->fp)
     return sox_false;
-  fstat(fileno((FILE*)ft->fp), &st);
+  int fd = fileno((FILE*)ft->fp);
+  if (fd < 0)
+    return sox_false;
+  if (fstat(fd, &st) < 0)
+    return sox_false;
   return ((st.st_mode & S_IFMT) == S_IFREG);
 }