Bug 2286: assertion failed: HttpHdrContRange.cc:100: "spec->length >= 0"
Moves the assertion check for spec->length in function
httpHdrRangeRespSpecParseInit exactly after the spec->length copmuted.
Also Fix of a possible misuse of errno in httpHeaderParseOffset function
The errno before used with strtol function must set to "0".
return 0;
spec->length = size_diff(last_pos + 1, spec->offset);
+ /* Ensure typecast is safe */
+ assert (spec->length >= 0);
}
- /* Ensure typecast is safe */
- assert (spec->length >= 0);
-
/* we managed to parse, check if the result makes sence */
if (known_spec(spec->length) && spec->length == 0) {
debugs(68, 2, "invalid range (" << spec->offset << " += " <<
int
httpHeaderParseOffset(const char *start, int64_t * value)
{
+ errno = 0;
int64_t res = strtoll(start, NULL, 10);
if (!res && EINVAL == errno) /* maybe not portable? */
return 0;