Fixed bounds check in image_setPixel/setMaskPixel
This commit is contained in:
@@ -30,14 +30,14 @@ typedef struct {
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
void image_setPixel(image_t* self, int x, int y, pixel_t val) {
|
void image_setPixel(image_t* self, int x, int y, pixel_t val) {
|
||||||
if (x > 0 && x < self->width && y > 0 && y < self->height) {
|
if (x >= 0 && x < self->width && y >= 0 && y < self->height) {
|
||||||
self->data[x + y * self->width] = val;
|
self->data[x + y * self->width] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void image_setMaskPixel(image_t* self, int x, int y, pixel_t val) {
|
void image_setMaskPixel(image_t* self, int x, int y, pixel_t val) {
|
||||||
if (x > 0 && x < self->width && y > 0 && y < self->height) {
|
if (x >= 0 && x < self->width && y >= 0 && y < self->height) {
|
||||||
self->mask[x + y * self->width] = val;
|
self->mask[x + y * self->width] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user