Bug fix in overallocated analyzed and fixed courtesy of Peter J. Creath

This commit is contained in:
rocky
2005-10-03 02:31:11 +00:00
parent 16e7b54f92
commit c6dfef5d24
2 changed files with 6 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: cddap_interface.c,v 1.1 2005/02/05 16:25:51 rocky Exp $
$Id: cddap_interface.c,v 1.2 2005/10/03 02:31:11 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Original interface.c Copyright (C) 1994-1997
@@ -191,9 +191,11 @@ jitter_read (cdrom_drive_t *d, void *p, lsn_t begin, long i_sectors,
/* Had to reduce # of sectors due to read errors. So give full amount,
with no jittering. */
memcpy(p, p_buf, i_sectors*CDIO_CD_FRAMESIZE_RAW);
else
else {
/* Got full amount, but now adjust size for jittering. */
memcpy(p, p_buf+i_jitter_offset, i_sectors_orig*CDIO_CD_FRAMESIZE_RAW);
i_sectors = i_sectors_orig;
}
free(p_buf);
return(i_sectors);

View File

@@ -1,5 +1,5 @@
/*
$Id: paranoia.c,v 1.11 2005/07/07 06:51:13 rocky Exp $
$Id: paranoia.c,v 1.12 2005/10/03 02:31:11 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -1213,19 +1213,7 @@ i_read_c_block(cdrom_paranoia_t *p,long beginword,long endword,
new=new_c_block(p);
}
/* FIXME: We allocate one extra frame more than what we should be
using. In cdda_read() when the CD-ROM endian-ness is different
from the machine endian-ness and we need to swap bytes, we seem
to be accessing outside of buffer in some (but not all)
cases. This is probably due to this routine calling cdda_read
with parameter that would have it access outside the allocated
range. Since I don't know how to fix, we'll do the harmless over
allocation.
On a sparc (Big Endian) Solaris with a little-endian CD-ROM. The
symptom would be that the calloc *after* the one below would fail.
*/
buffer=calloc((totaltoread+1)*CDIO_CD_FRAMESIZE_RAW, 1);
buffer=calloc(totaltoread*CDIO_CD_FRAMESIZE_RAW, 1);
sofar=0;
firstread=-1;