fix potential out of bound array access in Button_Layer_add()
This commit is contained in:
parent
d47bd55eda
commit
53296293ee
16
src/layers.c
16
src/layers.c
@ -106,11 +106,23 @@ void Layer_activate(int layer, short side)
|
|||||||
|
|
||||||
void Button_Layer_add(void)
|
void Button_Layer_add(void)
|
||||||
{
|
{
|
||||||
int max[] = {MAX_NB_LAYERS, MAX_NB_FRAMES, 5};
|
int max;
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
if (Main.backups->Pages->Nb_layers < max[Main.backups->Pages->Image_mode])
|
switch (Main.backups->Pages->Image_mode)
|
||||||
|
{
|
||||||
|
case IMAGE_MODE_LAYERED:
|
||||||
|
max = MAX_NB_LAYERS;
|
||||||
|
break;
|
||||||
|
case IMAGE_MODE_ANIMATION:
|
||||||
|
max = MAX_NB_FRAMES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
max = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Main.backups->Pages->Nb_layers < max)
|
||||||
{
|
{
|
||||||
// Backup with unchanged layers
|
// Backup with unchanged layers
|
||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user