fix a crash in arg handling on Windows

we were not updating argc in vips.c after all calls to
g_option_context_parse_strv() on Windows, leading to a crash in some cases

see https://github.com/jcupitt/libvips/issues/553
This commit is contained in:
John Cupitt 2016-11-11 10:14:03 +00:00
parent c0ab8b0ab1
commit 96ef05a9d1
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,6 @@
11/11/16 started 8.4.4
- fix crash in vips.exe arg parsing on Windows, thanks Yury
18/10/16 started 8.4.3
- fix error detection in gif_close, thanks aaron42net
- fix tiny threading memleak

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [8.4.3], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [8.4.4], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [4])
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])
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=48
LIBRARY_REVISION=3
LIBRARY_REVISION=4
LIBRARY_AGE=6
# patched into include/vips/version.h

View File

@ -1041,12 +1041,18 @@ parse_options( GOptionContext *context, int *argc, char **argv )
vips_error_exit( NULL );
}
/* On Windows, argc will not have been updated by
* g_option_context_parse_strv().
*/
for( *argc = 0; argv[*argc]; (*argc)++ )
;
/* Remove any "--" argument. If one of our arguments is a negative
* number, the user will need to have added the "--" flag to stop
* GOption parsing. But "--" is still passed down to us and we need to
* ignore it.
*/
for( i = 1; i < *argc - 1; i++ )
for( i = 1; i < *argc; i++ )
if( strcmp( argv[i], "--" ) == 0 ) {
for( j = i; j < *argc; j++ )
argv[j] = argv[j + 1];