fix rank fast path

there was an off-by-one error which could cause an out of bounds read

see https://github.com/libvips/libvips/issues/2401
This commit is contained in:
John Cupitt 2021-08-16 17:46:25 +01:00
parent 3ccf1761dd
commit e60f11eb45
3 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,6 @@
16/8/21 started 8.11.4
- fix off-by-one error in new rank fast path
14/7/21 started 8.11.3
- build threadpool later [kleisauke]
- add jxlsave prototypes [adil-benameur]

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips],[8.11.3],[vipsip@jiscmail.ac.uk])
AC_INIT([vips],[8.11.4],[vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ([2.69])
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [11])
m4_define([vips_micro_version], [3])
m4_define([vips_micro_version], [4])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -43,7 +43,7 @@ VIPS_LIBS=""
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=55
LIBRARY_REVISION=2
LIBRARY_REVISION=3
LIBRARY_AGE=13
# patched into include/vips/version.h

View File

@ -175,6 +175,7 @@ vips_rank_generate_uchar( VipsRegion *or,
VipsImage *in = seq->ir->im;
VipsRect *r = &or->valid;
const int bands = in->Bands;
const int last = bands * (rank->width - 1);
/* Get input and output pointers for this line.
*/
@ -229,7 +230,7 @@ vips_rank_generate_uchar( VipsRegion *or,
p1 = p + b;
for( j = 0; j < rank->height; j++ ) {
hist[p1[0]] -= 1;
hist[p1[bands * rank->width]] += 1;
hist[p1[last]] += 1;
p1 += lsk;
}