[MPlayer-dev-eng] [PATCH] Segfault fix for cvid
Roberto Togni
rtogni at bresciaonline.it
Sun Sep 15 22:33:49 CEST 2002
This patch fixes a segfault for native cvid decoder in bgr32 and bgr24
modes.
There are probably other problems with this codec in bgr mode if height
and/or width are not divisible by 4. I'm looking into them.
What's the policy for patching unmantained code (noone is mentioned as
the mantainer of cinepak codec)? Should I commit the pach directly or
post it to the list?
Ciao,
Roberto
-------------- next part --------------
--- cinepak.c.orig Sat Apr 13 21:14:32 2002
+++ cinepak.c Sun Sep 15 22:05:55 2002
@@ -352,7 +352,7 @@
/* ------------------------------------------------------------------------ */
inline void cvid_v1_32(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb)
{
-int stride = mpi->stride[0];
+int stride = mpi->stride[0]/4;
unsigned long *vptr = (unsigned long *)mpi->planes[0];
unsigned long rgb;
@@ -378,7 +378,7 @@
inline void cvid_v4_32(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0,
cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
{
-int stride = mpi->stride[0];
+int stride = mpi->stride[0]/4;
unsigned long *vptr = (unsigned long *)mpi->planes[0];
if(y+3>=(unsigned int)mpi->height) return; // avoid sig11
@@ -450,8 +450,8 @@
inline void cvid_v1_24(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb)
{
unsigned char r, g, b;
-int stride = (mpi->stride[0]-4)*3;
-unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0] + x) * 3;
+int stride = (mpi->stride[0])-4*3;
+unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0]) + x * 3;
if(y+3>=(unsigned int)mpi->height) return; // avoid sig11
@@ -481,8 +481,8 @@
inline void cvid_v4_24(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0,
cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
{
-int stride = (mpi->stride[0]-4)*3;
-unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0] + x) * 3;
+int stride = (mpi->stride[0])-4*3;
+unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0]) + x * 3;
if(y+3>=(unsigned int)mpi->height) return; // avoid sig11
More information about the MPlayer-dev-eng
mailing list