Handle enormous record sizes better

Formerly the code could misbehave when the user specified a record
size greater than min (INT_MAX * 512 + 511, PTRDIFF_MAX, SSIZE_MAX).
* src/delete.c (new_blocks, delete_archive_members):
* src/system.c (sys_exec_info_script):
* src/tar.c (blocking_factor, record_size):
Don’t limit blocking factor to INT_MAX.
Prefer signed type for record_size.
Do not exceed IDX_MAX or SSIZE_MAX for record_size;
the SSIZE_MAX limit is needed so that ‘read’ and ‘write’
calls behave sensibly.
This commit is contained in:
Paul Eggert
2024-08-08 10:51:39 -07:00
parent eb9bb9bf80
commit 3ffe2eb073
5 changed files with 17 additions and 15 deletions

View File

@@ -98,8 +98,8 @@ extern enum archive_format archive_format;
are always related, the second being BLOCKSIZE times the first. They do
not have _option in their name, even if their values is derived from
option decoding, as these are especially important in tar. */
extern int blocking_factor;
extern size_t record_size;
extern idx_t blocking_factor;
extern idx_t record_size;
extern bool absolute_names_option;