Pārlūkot izejas kodu

rtextures: Fix ImageFromImage crash (#2594)

Height of the rectangle can be float, which
may lead to doing extra iteration of loop and
writing out of bounds.
pull/2596/head
Piotr Wierciński pirms 2 gadiem
committed by GitHub
vecāks
revīzija
5a2f25cc7c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. +1
    -1
      src/rtextures.c

+ 1
- 1
src/rtextures.c Parādīt failu

@ -879,7 +879,7 @@ Image ImageFromImage(Image image, Rectangle rec)
result.format = image.format;
result.mipmaps = 1;
for (int y = 0; y < rec.height; y++)
for (int y = 0; y < p">(int)rec.height; y++)
{
memcpy(((unsigned char *)result.data) + y*(int)rec.width*bytesPerPixel, ((unsigned char *)image.data) + ((y + (int)rec.y)*image.width + (int)rec.x)*bytesPerPixel, (int)rec.width*bytesPerPixel);
}

Notiek ielāde…
Atcelt
Saglabāt