fix crashes in bilinear final filter + HD prescaling (buffer overflows in sloppy filter code, as usual)

This commit is contained in:
zeromus 2016-05-09 22:23:54 +00:00
parent 13032f6712
commit afb63d0b2f
1 changed files with 6 additions and 8 deletions

View File

@ -17,6 +17,12 @@ int systemBlueShift = 0;
*/
#define RGB1(r,g,b) (((r))<<systemRedShift) | (((g)) << systemGreenShift) | (((b)) << systemBlueShift)
//kind of a waste of memory, it'd be nice if we could share this with other filters
//then again, we may want to multi-thread them later, so.. we should allocate filter objects which carry their own buffers
//the largest conceivable prescale... 32x!
static u8 row_cur[3*(256+8)*32];
static u8 row_next[3*(256+8)*32];
static void fill_rgb_row_16(u16 *from, int src_width, u8 *row, int width)
{
u8 *copy_start = row + src_width*3;
@ -66,8 +72,6 @@ static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width)
void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 row_cur[3*322];
u8 row_next[3*322];
u8 *rgb_row_cur = row_cur;
u8 *rgb_row_next = row_next;
@ -149,8 +153,6 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 row_cur[3*322];
u8 row_next[3*322];
u8 *rgb_row_cur = row_cur;
u8 *rgb_row_next = row_next;
@ -243,8 +245,6 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 row_cur[3*322];
u8 row_next[3*322];
u8 *rgb_row_cur = row_cur;
u8 *rgb_row_next = row_next;
@ -331,8 +331,6 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 row_cur[3*322];
u8 row_next[3*322];
u8 *rgb_row_cur = row_cur;
u8 *rgb_row_next = row_next;