alpine 3.8
integer weakness #17

2

Weakness Breakdown


Definition:

An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:

gdk-pixbuf/src/gdk-pixbuf-2.36.11/gdk-pixbuf/pixops/timescale.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.8 integer weakness.

 	    case PIXOPS_INTERP_HYPER:
	      printf ("  HYPER\n");
	      break;
	    }
	}
    }
  printf("\n");
}

#define ITERS 10

int main (int argc, char **argv)
{
  int src_width, src_height, dest_width, dest_height;
  unsigned char *src_buf, *dest_buf;
  int src_index, dest_index;
  int i;
  double scale_times[3][3][4];
  double composite_times[3][3][4];
  double composite_color_times[3][3][4];

  if (argc == 5)
    {
      src_width = atoi(argv[1]);
      src_height = atoi(argv[2]);
      dest_width = atoi(argv[3]);
      dest_height = atoi(argv[4]);
    }
  else if (argc == 1)
    {
      src_width = 343;
      src_height = 343;
      dest_width = 711;
      dest_height = 711;
    }
  else
    {
      fprintf (stderr, "Usage: scale [src_width src_height dest_width dest_height]\n");
      exit(1);
    }


  printf ("Scaling from (%d, %d) to (%d, %d)\n\n", src_width, src_height, dest_width, dest_height);

  init_array (scale_times);
  init_array (composite_times);
  init_array (composite_color_times);

  for (src_index = 0; src_index < 3; src_index++)
    for (dest_index = 0; dest_index < 3; dest_index++) 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.