Skip to content

Commit

Permalink
Fix buffer overflow with widths over 8192 or so
Browse files Browse the repository at this point in the history
Pinpointed with valgrind.
  • Loading branch information
cantabile committed Apr 16, 2015
1 parent 7e72c5d commit 89819db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nnedi3.cpp
Expand Up @@ -1201,7 +1201,10 @@ static const VSFrameRef *VS_CC nnedi3GetFrame(int n, int activationReason, void
}

frameData->input = vs_aligned_malloc<float>(512 * sizeof(float), 16);
frameData->temp = vs_aligned_malloc<float>(2048 * sizeof(float), 16);
// evalFunc_0 requires at least padded_width[0] bytes.
// evalFunc_1 requires at least 512 floats.
size_t temp_size = max((size_t)frameData->padded_width[0], 512 * sizeof(float));
frameData->temp = vs_aligned_malloc<float>(temp_size, 16);

// Copy src to a padded "frame" in frameData and mirror the edges.
d->copyPad(src, frameData, instanceData, field_n, vsapi);
Expand Down

0 comments on commit 89819db

Please sign in to comment.