Bug fix: Non-SUSP data in System Use Area prevented image loading if Rock Ridge was enabled. Thanks to Jonathan Dowland.

This commit is contained in:
Thomas Schmitt 2016-11-23 22:52:11 +01:00
parent 01020ef544
commit 8ec75eea6a
3 changed files with 22 additions and 7 deletions

View File

@ -1582,7 +1582,7 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
{ret = ISO_OUT_OF_MEM; goto ex;}
}
while ((ret = susp_iter_next(iter, &sue)) > 0) {
while ((ret = susp_iter_next(iter, &sue, 0)) > 0) {
/* ignore entries from different version */
if (sue->version[0] != 1)
@ -2398,7 +2398,7 @@ int read_root_susp_entries(_ImageFsData *data, uint32_t block)
}
/* first entry must be an SP system use entry */
ret = susp_iter_next(iter, &sue);
ret = susp_iter_next(iter, &sue, 1);
if (ret < 0) {
/* error */
susp_iter_free(iter);
@ -2442,7 +2442,7 @@ int read_root_susp_entries(_ImageFsData *data, uint32_t block)
* no?), but if we finally need it, it can be easily implemented in
* the iterator, transparently for the rest of the code.
*/
while ((ret = susp_iter_next(iter, &sue)) > 0) {
while ((ret = susp_iter_next(iter, &sue, 0)) > 0) {
/* ignore entries from different version */
if (sue->version[0] != 1)

View File

@ -266,7 +266,8 @@ susp_iter_new(IsoDataSource *src, struct ecma119_dir_record *record,
* @return
* 1 on success, 0 if no more entries, < 0 error
*/
int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue);
int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue,
int flag);
/**
* Free a given susp iterator.

View File

@ -67,12 +67,26 @@ susp_iter_new(IsoDataSource *src, struct ecma119_dir_record *record,
return iter;
}
int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue)
/* @param flag bit0 = First call on root:
Not yet clear whether this is SUSP at all
*/
int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue,
int flag)
{
struct susp_sys_user_entry *entry;
entry = (struct susp_sys_user_entry*)(iter->base + iter->pos);
if (flag & 1) {
/* Yet unclear whether it is SUSP at all */
if (iter->size < 7)
return 0;
if (!SUSP_SIG(entry, 'S', 'P'))
return 0;
if (entry->len_sue[0] < 7)
return 0;
/* Looks like SUSP enough to pass the further processing here. */
}
if ( (iter->pos + 4 > iter->size) || (SUSP_SIG(entry, 'S', 'T'))) {
/*
@ -134,10 +148,10 @@ int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue)
}
/* we don't want to return CE entry to the user */
return susp_iter_next(iter, sue);
return susp_iter_next(iter, sue, 0);
} else if (SUSP_SIG(entry, 'P', 'D')) {
/* skip padding */
return susp_iter_next(iter, sue);
return susp_iter_next(iter, sue, 0);
}
*sue = entry;