blob: b54b3ba669b29903c34163c39324eba92de6a5ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
src/file_io.c : Prevent potential divide-by-zero.
Closes: https://github.com/erikd/libsndfile/issues/92
Upstream-Status: Backport
Fixes CVE-2014-9756
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
diff -Naur libsndfile-1.0.25-orig/src/file_io.c libsndfile-1.0.25/src/file_io.c
--- libsndfile-1.0.25-orig/src/file_io.c 2011-01-19 12:12:28.000000000 +0200
+++ libsndfile-1.0.25/src/file_io.c 2015-11-04 15:02:04.337395618 +0200
@@ -358,6 +358,9 @@
{ sf_count_t total = 0 ;
ssize_t count ;
+ if (bytes == 0 || items == 0)
+ return 0 ;
+
if (psf->virtual_io)
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
|