Skip to content

Encoder commandline parsing crashes

The encoder application crashes for malformed commandline arguments since in some instances the call to usage_enc() is not followed by a proper return/cleanup.

For example: ./IVAS_cod -ism_sba 4 3 32000 48 scripts/testv/stvOSBA_4ISM_3OA48c.wav osba.bit Causes the usage printout to occur 4 times and then the application attempts to proceed as normal but performs an invalid memory access trying to print out the ISM metadata file names:

Process 664242 stopped
* thread #1, name = 'IVAS_cod', stop reason = breakpoint 1.1
    frame #0: 0x0000555555559adf IVAS_cod`main(argc=8, argv=0x00007fffffffdb08) at encoder.c:252:13
   249 	   {
   250 	       for ( i = 0; i < arg.inputFormatConfig.ism.numObjects; i++ )
   251 	       {
-> 252 	           fprintf( stdout, "Object %d input metadata: %s\n", i + 1, arg.inputFormatConfig.ism.metadataFiles[i] );
   253 	       }
   254 	   }
   255 	
(lldb) p arg.inputFormatConfig.ism.metadataFiles
(const char *[4]) $0 = ([0] = 0x0000000000000000, [1] = 0x0000000000000000, [2] = 0x0000000000000000, [3] = "")
...
Process 664242 stopped
* thread #1, name = 'IVAS_cod', stop reason = signal SIGSEGV: invalid address (fault address: 0x800)
    frame #0: 0x00007ffff7e32f19 libc.so.6`__strlen_avx2 at strlen-avx2.S:76
Edited by Archit Tamarapu