fe2883767d
Backport fix for a NULL pointer dereference Resolves: #1502655
33 lines
1.3 KiB
Diff
33 lines
1.3 KiB
Diff
From 91637c8319202758f52c6bd31d7264d6b6a74ee1 Mon Sep 17 00:00:00 2001
|
|
From: PHO <pho@cielonegro.org>
|
|
Date: Fri, 2 Oct 2015 09:31:46 +0900
|
|
Subject: [PATCH] Fix NULL pointer dereference that occurs when byte swapping
|
|
is needed
|
|
|
|
cdrom_cache_handler() calls cdio_cddap_read_timed() with buffer == NULL. When this happens on a platform where byte swapping is needed, the latter crashes for dereferencing a NULL pointer.
|
|
---
|
|
configure.ac | 14 ++++++----
|
|
lib/cdda_interface/interface.c | 2 +-
|
|
test/.gitignore | 5 ++++
|
|
test/Makefile.am | 4 +--
|
|
test/endian.sh.in | 59 ++++++++++++++++++++++++++++++++++++++++++
|
|
5 files changed, 76 insertions(+), 8 deletions(-)
|
|
create mode 100644 test/endian.sh.in
|
|
|
|
diff --git a/lib/cdda_interface/interface.c b/lib/cdda_interface/interface.c
|
|
index 08a96f3..bfb9ac3 100644
|
|
--- a/lib/cdda_interface/interface.c
|
|
+++ b/lib/cdda_interface/interface.c
|
|
@@ -155,7 +155,7 @@ cdio_cddap_read_timed(cdrom_drive_t *d, void *buffer, lsn_t beginsector,
|
|
if ( d->bigendianp == -1 ) /* not determined yet */
|
|
d->bigendianp = data_bigendianp(d);
|
|
|
|
- if ( d->b_swap_bytes && d->bigendianp != bigendianp() ) {
|
|
+ if ( buffer && d->b_swap_bytes && d->bigendianp != bigendianp() ) {
|
|
int i;
|
|
uint16_t *p=(uint16_t *)buffer;
|
|
long els=sectors*CDIO_CD_FRAMESIZE_RAW/2;
|
|
--
|
|
2.14.2
|
|
|