* Report an error if we didn't consume at least one character, if the
* result is 0, or if the value is too large to be a valid OID.
*/
- if (suffix == NULL || num <= 0 || num > OID_MAX)
+ if (suffix == relpath || num <= 0 || num > OID_MAX)
{
report_backup_error(context,
"file \"%s\" is not expected in a tar format backup",
{"PostgreSQL-Backup-Manifest-Version": 9876599}
EOM
+test_parse_error('system identifier in manifest not an integer', <<EOM);
+{"PostgreSQL-Backup-Manifest-Version": 1, "System-Identifier": ""}
+EOM
+
test_parse_error('unexpected scalar', <<EOM);
{"PostgreSQL-Backup-Manifest-Version": 1, "Files": true}
EOM
]}
EOM
+test_parse_error('file size is not an integer', <<EOM);
+{"PostgreSQL-Backup-Manifest-Version": 1, "Files": [
+ {"Path": "x", "Size": ""}
+]}
+EOM
+
test_parse_error('could not decode file name', <<EOM);
{"PostgreSQL-Backup-Manifest-Version": 1, "Files": [
{"Encoded-Path": "123", "Size": 0}
]}
EOM
+test_parse_error('timeline is not an integer', <<EOM);
+{"PostgreSQL-Backup-Manifest-Version": 1, "WAL-Ranges": [
+ {"Timeline": "", "Start-LSN": "0/0", "End-LSN": "0/0"}
+]}
+EOM
+
test_parse_error('could not parse start LSN', <<EOM);
{"PostgreSQL-Backup-Manifest-Version": 1, "WAL-Ranges": [
{"Timeline": 1, "Start-LSN": "oops", "End-LSN": "0/0"}
/* Parse system identifier. */
system_identifier = strtou64(parse->manifest_system_identifier, &ep, 10);
- if (*ep)
+ if (ep == parse->manifest_system_identifier || *ep)
json_manifest_parse_failure(parse->context,
"system identifier in manifest not an integer");
/* Parse size. */
size = strtou64(parse->size, &ep, 10);
- if (*ep)
+ if (ep == parse->size || *ep)
json_manifest_parse_failure(parse->context,
"file size is not an integer");
/* Parse timeline. */
tli = strtoul(parse->timeline, &ep, 10);
- if (*ep)
+ if (ep == parse->timeline || *ep)
json_manifest_parse_failure(parse->context,
"timeline is not an integer");
if (!parse_xlogrecptr(&start_lsn, parse->start_lsn))