Issue 30977  —   Executing UHTTP.GET_INFO("RANGE") can cause crash

Status:   Planned for resolution in 10.4.01

Solution available in patch(es):      10.3.02.000    9.7.05.013

Description:

 Uniface: The UHTTP operation GET_INFO("RANGE") can cause a crash when it is
 called after the operation LOAD_FILE_CONTENTS/DUMP_FILE_CONTENTS has returned
 an error ($status < 0) or when the CHUNK option (for chunked transfer) is not
 specified.

 Environment:
 +Uniface:
 * Version 9.6.07 (and higher) - Service Pack MX06

 +Operating System:
 * OS independent

 +Database:
 * DBMS independent

 Symptoms:
 The UHTTP operation GET_INFO("RANGE") can cause a crash when it is called after
 the operation LOAD_FILE_CONTENTS/DUMP_FILE_CONTENTS has returned an error
 ($status < 0) or when the CHUNK option (for chunked transfer) is not specified.

 The described problem can (e.g.) be replicated when the operation
 LOAD_FILE_CONTENTS has returned an error; e.g.

 * -1 - Cannot open the specified file
 * -4  - Invalid option in the OptionList
 * -14 - The body of the request has not been completely read by a previous call

 Consider the following Proc:

 newinstance "UHTTP", vUHTTP
 vUhttp->LOAD_FILE_CONTENTS("some.txt", "CHUNK=10240")
 ; => $status = -1 (Cannot open the specified file)
 vUhttp->GET_INFO("RANGE", vInfo)
 vUhttp->CLOSE_FILE()
 deleteinstance vUHTTP

 When executing the above Proc a crash will occur when GET_INFO("RANGE") is
 executed.

 In this example an existing file is loaded but the CHUNK option is not used:

 newinstance "UHTTP", vUHTTP
 vUhttp->LOAD_FILE_CONTENTS("document.txt", "")
 ; => $status > 0 (number of bytes loaded)
 vUhttp->GET_INFO("RANGE", vInfo)
 vUhttp->CLOSE_FILE()
 deleteinstance vUHTTP

 Again, when executing the GET_INFO("RANGE") operation a crash occurs.

Workaround:

 Don't call the UHTTP operation GET_INFO("RANGE") if the operation
 LOAD_FILE_CONTENTS returned an error ($status < 0) or when the CHUNK option is
 not used.

Notes: