diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-04-09 18:25:35 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-04-09 18:25:35 +0000 |
commit | eae97616d57c8506985ae0f202d57ee396c17ba1 (patch) | |
tree | 445bcda4193d0c605e9fbebf22bc66e39ac1dd16 /libmpcodecs/native | |
parent | ed8211b89caaadd3360b8b5a90fc809a0aa48483 (diff) | |
download | mpv-eae97616d57c8506985ae0f202d57ee396c17ba1.tar.bz2 mpv-eae97616d57c8506985ae0f202d57ee396c17ba1.tar.xz |
10l, we should really, really use lzo1x_decompress_safe instead of lzo1x_decompress
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18069 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/native')
-rw-r--r-- | libmpcodecs/native/nuppelvideo.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libmpcodecs/native/nuppelvideo.c b/libmpcodecs/native/nuppelvideo.c index e7157be301..2dd4ee09da 100644 --- a/libmpcodecs/native/nuppelvideo.c +++ b/libmpcodecs/native/nuppelvideo.c @@ -27,7 +27,7 @@ void decode_nuv( unsigned char *encoded, int encoded_size, unsigned char *decoded, int width, int height) { int r; - unsigned int out_len; + unsigned int out_len = width * height + ( width * height ) / 2; struct rtframeheader *encodedh = ( struct rtframeheader* ) encoded; static unsigned char *buffer = 0; /* for RTJpeg with LZO decompress */ #ifdef KEEP_BUFFER @@ -56,7 +56,7 @@ void decode_nuv( unsigned char *encoded, int encoded_size, { #ifdef KEEP_BUFFER if (!previous_buffer) - previous_buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 ); + previous_buffer = ( unsigned char * ) malloc ( out_len ); #endif if (((encodedh->comptype == '2') || @@ -74,20 +74,20 @@ void decode_nuv( unsigned char *encoded, int encoded_size, switch(encodedh->comptype) { case '0': /* raw YUV420 */ - memcpy(decoded, encoded + 12, width*height*3/2); + memcpy(decoded, encoded + 12, out_len); break; case '1': /* RTJpeg */ RTjpeg_decompressYUV420 ( ( __s8 * ) encoded + 12, decoded ); break; case '2': /* RTJpeg with LZO */ if (!buffer) - buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 ); + buffer = ( unsigned char * ) malloc ( out_len ); if (!buffer) { mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); break; } - r = lzo1x_decompress ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL ); + r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL ); if ( r != LZO_E_OK ) { mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); @@ -96,7 +96,7 @@ void decode_nuv( unsigned char *encoded, int encoded_size, RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded ); break; case '3': /* raw YUV420 with LZO */ - r = lzo1x_decompress ( encoded + 12, encodedh->packetlength, decoded, &out_len, NULL ); + r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, decoded, &out_len, NULL ); if ( r != LZO_E_OK ) { mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); |