mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Fix warnings about invalid reads in AVX2 ipol
AVX2 filter functions read pixels in chunks of 8 or 16 bytes. At the end of the block, the read goes out of the bounds of the pixels array. The extra pixels do not affect the result. Fixes valgrind complaining about the invalid reads by allocating 5 extra pixels in kvz_get_extended_block_avx2
This commit is contained in:
parent
4d20e156db
commit
2c66e0bbd2
|
@ -1384,7 +1384,9 @@ void kvz_get_extended_block_avx2(int xpos, int ypos, int mv_x, int mv_y, int off
|
||||||
int sample_out_of_bounds = out_of_bounds_y || out_of_bounds_x;
|
int sample_out_of_bounds = out_of_bounds_y || out_of_bounds_x;
|
||||||
|
|
||||||
if (sample_out_of_bounds){
|
if (sample_out_of_bounds){
|
||||||
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (height + filter_size));
|
// Alloc 5 pixels more than we actually use because AVX2 filter
|
||||||
|
// functions read up to 5 pixels past the last pixel.
|
||||||
|
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (height + filter_size) + 5);
|
||||||
if (!out->buffer){
|
if (!out->buffer){
|
||||||
fprintf(stderr, "Memory allocation failed!\n");
|
fprintf(stderr, "Memory allocation failed!\n");
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
Loading…
Reference in a new issue