Input validation: guard makepalookup 'pal', 2dcol 'col'. Add one const.

git-svn-id: https://svn.eduke32.com/eduke32@2500 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-18 23:17:51 +00:00
parent eb52100654
commit 359614df70
3 changed files with 6 additions and 3 deletions

View file

@ -561,7 +561,7 @@ void loadtile(int16_t tilenume);
int32_t qloadkvx(int32_t voxindex, const char *filename); int32_t qloadkvx(int32_t voxindex, const char *filename);
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
//void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); //void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat); void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
//void setvgapalette(void); //void setvgapalette(void);
void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount); void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount);
void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags); void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags);

View file

@ -380,7 +380,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getnumber(script,&g)) break; if (scriptfile_getnumber(script,&g)) break;
if (scriptfile_getnumber(script,&b)) break; if (scriptfile_getnumber(script,&b)) break;
if (col < 256) if ((unsigned)col < 256)
{ {
vgapal16[col*4+0] = b; // blue vgapal16[col*4+0] = b; // blue
vgapal16[col*4+1] = g; // green vgapal16[col*4+1] = g; // green

View file

@ -13519,13 +13519,16 @@ void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
// //
// makepalookup // makepalookup
// //
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat) void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat)
{ {
int32_t i, j, palscale; int32_t i, j, palscale;
char *ptr, *ptr2; char *ptr, *ptr2;
if (paletteloaded == 0) return; if (paletteloaded == 0) return;
if ((unsigned)palnum >= MAXPALOOKUPS)
return;
if (palookup[palnum] == NULL) if (palookup[palnum] == NULL)
{ {
//Allocate palookup buffer //Allocate palookup buffer