mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix out of range read/write in _copyPixelsFromRdram when address in input array is outside of current frame buffer.
This commit is contained in:
parent
8f952921a0
commit
235530cec8
|
@ -1620,9 +1620,13 @@ bool _copyPixelsFromRdram(u32 _address, const vector<u32> & _vecAddress, u32* _d
|
||||||
u32 summ = 0;
|
u32 summ = 0;
|
||||||
u32 idx, w, h;
|
u32 idx, w, h;
|
||||||
for (size_t i = 0; i < numPixels; ++i) {
|
for (size_t i = 0; i < numPixels; ++i) {
|
||||||
|
if (_vecAddress[i] < _address)
|
||||||
|
return false;
|
||||||
idx = (_vecAddress[i] - _address) / szPixel;
|
idx = (_vecAddress[i] - _address) / szPixel;
|
||||||
w = idx % _width;
|
w = idx % _width;
|
||||||
h = idx / _width;
|
h = idx / _width;
|
||||||
|
if (h > _height)
|
||||||
|
return false;
|
||||||
col = src[idx];
|
col = src[idx];
|
||||||
summ += col;
|
summ += col;
|
||||||
_dst[(w + (_height - h)*_width) ^ _xor] = converter(col, _bCFB);
|
_dst[(w + (_height - h)*_width) ^ _xor] = converter(col, _bCFB);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user