Browse Source

Bug fix: Prevent allocation of empty hash tables. Thanks Richard Nolde.

release-1.5.4.branch
Thomas Schmitt 8 years ago
parent
commit
0e00aeb638
  1. 3
      libisofs/ecma119_tree.c
  2. 7
      libisofs/util_htable.c

3
libisofs/ecma119_tree.c

@ -592,6 +592,9 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
nchildren = dir->info.dir->nchildren;
children = dir->info.dir->children;
if (nchildren <= 0)
return ISO_SUCCESS; /* nothing to do */
/* a hash table will temporary hold the names, for fast searching */
ret = iso_htable_create((nchildren * 100) / 80, iso_str_hash,
(compare_function_t)strcmp, &table);

7
libisofs/util_htable.c

@ -322,9 +322,10 @@ int iso_htable_create(size_t size, hash_funtion_t hash,
{
IsoHTable *t;
if (table == NULL) {
return ISO_OUT_OF_MEM;
}
if (size <= 0)
return ISO_WRONG_ARG_VALUE;
if (table == NULL)
return ISO_NULL_POINTER;
t = malloc(sizeof(IsoHTable));
if (t == NULL) {

Loading…
Cancel
Save