Skip to content

Commit

Permalink
Address buffer overflow crash in video effect xLightsSequencer#5208
Browse files Browse the repository at this point in the history
  • Loading branch information
derwin12 committed Feb 17, 2025
1 parent 138f3a2 commit 5a54b39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xLights/effects/VideoEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ void VideoEffect::Render(RenderBuffer &buffer, std::string filename,
// wxASSERT(yoffset + ytail + buffer.BufferHt == _videoreader->GetHeight());

ispc::VideoData rdata;
rdata.width = buffer.BufferWi;
rdata.height = buffer.BufferHt;
rdata.width = _videoreader->GetWidth() - xoffset - xtail;
rdata.height = _videoreader->GetHeight() - yoffset - ytail;
rdata.ytail = ytail;
rdata.xtail = xtail;
rdata.yoffset = yoffset;
Expand All @@ -501,7 +501,7 @@ void VideoEffect::Render(RenderBuffer &buffer, std::string filename,
rdata.bufferData = (void*)&buffer;
rdata.sampleSpacing = sampleSpacing;

int max = buffer.BufferHt * buffer.BufferWi;
int max = std::min(rdata.width * rdata.height, buffer.BufferHt * buffer.BufferWi);
constexpr int bfBlockSize = 4096;
int blocks = max / bfBlockSize + 1;

Expand Down

0 comments on commit 5a54b39

Please sign in to comment.