[Horus] Protection against buffer overflow
This commit is contained in:
@@ -198,7 +198,8 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
|
||||
template<class T>
|
||||
void drawBitmap(coord_t x, coord_t y, const T * bmp, coord_t srcx=0, coord_t srcy=0, coord_t w=0, coord_t h=0, float scale=0)
|
||||
{
|
||||
if (!bmp) return;
|
||||
if (!bmp || x >= width || y >= height)
|
||||
return;
|
||||
|
||||
int srcw = bmp->getWidth();
|
||||
int srch = bmp->getHeight();
|
||||
@@ -211,7 +212,7 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
|
||||
w = srcw - srcx;
|
||||
if (srcy+h > srch)
|
||||
h = srch - srcy;
|
||||
|
||||
|
||||
if (scale == 0) {
|
||||
if (x + w > width) {
|
||||
w = width - x;
|
||||
|
||||
@@ -77,6 +77,7 @@ enum FontSizeIndex {
|
||||
SPAREf_INDEX,
|
||||
};
|
||||
|
||||
#define STDSIZE (STDSIZE_INDEX << 8)
|
||||
#define TINSIZE (TINSIZE_INDEX << 8)
|
||||
#define SMLSIZE (SMLSIZE_INDEX << 8)
|
||||
#define MIDSIZE (MIDSIZE_INDEX << 8)
|
||||
|
||||
Reference in New Issue
Block a user