From 51d0e7cf58908ff2da7a94c2e87d1e1859961072 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 12 Jan 2024 12:18:37 +0100 Subject: [PATCH 1/2] issue 956: Output correct error message when the decoder command-line has too many mandatory arguments; under FIX_956_DECODER_COMMAND_LINE_FIX --- apps/decoder.c | 10 ++++++++++ lib_com/options.h | 1 + 2 files changed, 11 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 54879bb30e..0a6d19dad8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1619,7 +1619,17 @@ static bool parseCmdlIVAS_dec( * Mandatory input arguments *-----------------------------------------------------------------*/ +#ifdef FIX_956_DECODER_COMMAND_LINE_FIX + if ( i < argc - 4 ) + { + fprintf( stderr, "Error: Too many mandatory command-line arguments\n\n" ); + usage_dec(); + return false; + } + else if ( i < argc - 3 ) +#else if ( i < argc - 3 ) +#endif { arg->outputConfig = cmdline2config( argv[i] ); if ( arg->outputConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) diff --git a/lib_com/options.h b/lib_com/options.h index fc6c6a06aa..2c837cba25 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,6 +155,7 @@ #define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ #define FIX_OLD_BINARY_FORMAT /* Orange: temporary to maintain bitexactness */ #define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ +#define FIX_956_DECODER_COMMAND_LINE_FIX /* VA: Output correct error message when the decoder command-line has too many mandatory arguments. */ /* #################### End BE switches ################################## */ -- GitLab From 36acfbf9afe3b6083cc05a19e75407a4ec62a69a Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 18 Jan 2024 10:05:50 +0100 Subject: [PATCH 2/2] add error message for wrong order of command-line parameters --- apps/decoder.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 0a6d19dad8..7c13aa693f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1622,6 +1622,16 @@ static bool parseCmdlIVAS_dec( #ifdef FIX_956_DECODER_COMMAND_LINE_FIX if ( i < argc - 4 ) { + for ( i = 1; i < argc; i++ ) + { + if ( argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Wrong order of command-line arguments (optional arguments are first)\n\n" ); + usage_dec(); + return false; + } + } + fprintf( stderr, "Error: Too many mandatory command-line arguments\n\n" ); usage_dec(); return false; -- GitLab