Browse Source

Bug fix: Large amounts of AAIP data or many long file names could cause with zisofs an unreadable filesystem after the warning "Calculated and written ECMA-119 tree end differ"

release-1.5.4.branch
Thomas Schmitt 2 months ago
parent
commit
408eb3f5c6
  1. 16
      libisofs/rockridge.c

16
libisofs/rockridge.c

@ -1166,7 +1166,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
size_t *su_size, size_t *ce, size_t base_ce, int flag)
{
char *name;
size_t namelen, su_mem, ce_mem;
size_t namelen, su_mem, ce_mem, ce_prepad = 0;
void *xipt;
size_t num_aapt = 0, sua_free = 0;
int ret;
@ -1197,7 +1197,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
#endif /* Libisofs_ce_calc_debuG */
*ce += BLOCK_SIZE - (base_ce % BLOCK_SIZE);
ce_prepad = BLOCK_SIZE - (base_ce % BLOCK_SIZE);
}
}
@ -1210,8 +1210,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
if (flag & 1) {
/* Account for 28 bytes of CE field */
if (*su_size + 28 > space)
if (*su_size + 28 > space) {
*ce += ce_prepad;
return -1;
}
*su_size += 28;
}
@ -1242,8 +1244,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
int cew = (*ce != 0); /* are we writing to CA ? */
dest = get_rr_fname(t, ((IsoSymlink*)n->node)->dest);
if (dest == NULL)
if (dest == NULL) {
*ce += ce_prepad;
return -2;
}
prev = dest;
cur = strchr(prev, '/');
while (1) {
@ -1353,6 +1357,9 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
if (*ce > 0 && !(flag & 1))
goto unannounced_ca;
*ce += ce_prepad;
ce_prepad = 0;
/* obtain num_aapt from node */
xipt = NULL;
num_aapt = 0;
@ -1405,6 +1412,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
}
}
*ce += ce_prepad;
return 1;
unannounced_ca:;

Loading…
Cancel
Save