Selaa lähdekoodia

Do not use _caca_alloc2d in the Ruby extension

main
Pascal Terjan 4 päivää sitten
vanhempi
commit
94517c520d
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. +6
    -1
      ruby/caca-canvas.c

+ 6
- 1
ruby/caca-canvas.c Näytä tiedosto

@@ -586,7 +586,12 @@ static VALUE render_canvas(VALUE self, VALUE font, VALUE width, VALUE height, VA
rb_raise(rb_eArgError, "First argument is not a Caca::Font");
}

buf = _caca_alloc2d(width, height, 4);
if (width == 0 || height == 0 || SIZE_MAX / width / height < 4)
{
rb_raise(rb_eRangeError, "width * height is too large");
}

buf = malloc(width * height * 4);
if(buf == NULL)
{
rb_raise(rb_eNoMemError, "Out of memory");


Ladataan…
Peruuta
Tallenna