| 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 ; |
| |