Blame SOURCES/libsndfile-1.0.25-zerodivfix.patch
|
|
e6061c |
From 725c7dbb95bfaf8b4bb7b04820e3a00cceea9ce6 Mon Sep 17 00:00:00 2001
|
|
|
e6061c |
From: Erik de Castro Lopo <erikd@mega-nerd.com>
|
|
|
e6061c |
Date: Wed, 24 Dec 2014 21:02:35 +1100
|
|
|
e6061c |
Subject: [PATCH] src/file_io.c : Prevent potential divide-by-zero.
|
|
|
e6061c |
|
|
|
e6061c |
Closes: https://github.com/erikd/libsndfile/issues/92
|
|
|
e6061c |
---
|
|
|
e6061c |
src/file_io.c | 5 ++++-
|
|
|
e6061c |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
e6061c |
|
|
|
e6061c |
diff --git a/src/file_io.c b/src/file_io.c
|
|
|
e6061c |
index 26d3d6d..6ccab78 100644
|
|
|
e6061c |
--- a/src/file_io.c
|
|
|
e6061c |
+++ b/src/file_io.c
|
|
|
e6061c |
@@ -1322,6 +1322,9 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|
|
e6061c |
{ sf_count_t total = 0 ;
|
|
|
e6061c |
ssize_t count ;
|
|
|
e6061c |
|
|
|
e6061c |
+ if (bytes == 0 || items == 0)
|
|
|
e6061c |
+ return 0 ;
|
|
|
e6061c |
+
|
|
|
e6061c |
if (psf->virtual_io)
|
|
|
e6061c |
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
|
|
e6061c |
|
|
|
e6061c |
|