Hello community,

here is the log from the commit of package libisofs for openSUSE:Factory 
checked in at 2018-02-09 15:42:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libisofs (Old)
 and      /work/SRC/openSUSE:Factory/.libisofs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libisofs"

Fri Feb  9 15:42:16 2018 rev:5 rq:574401 version:1.4.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/libisofs/libisofs.changes        2017-02-26 
17:05:37.184998272 +0100
+++ /work/SRC/openSUSE:Factory/.libisofs.new/libisofs.changes   2018-02-09 
15:42:18.266683436 +0100
@@ -1,0 +2,23 @@
+Thu Feb  8 20:12:14 UTC 2018 - asterios.dra...@gmail.com
+
+- Update to 1.4.8:
+  * Bug fix: iso_read_opts_set_no_rockridge() did not prevent
+    reading of root SUSP.
+  * Bug fix: Non-SUSP data in System Use Area prevented image
+    loading if Rock Ridge was enabled.
+  * Bug fix: Protective MBR for GPT could emerge with boot flag
+    set.
+  * Bug fix: Appended partitions of size >= 4 GiB led to abort with
+    error message "FATAL : ISO overwrite".
+  * Bug fix: Bit 15 of iso_write_opts_set_system_area did not work
+    with generic MBR.
+  * Bug fix: Keeping and patching of loaded boot images failed.
+    Regression by version 1.4.4.
+  * Bug fix: Program crashes by intentionally wrong ISO image
+    input. Debian bug reports: deb#872372, deb#872475, deb#872545,
+    deb#872590, deb#872761.
+  * New API calls el_torito_set_full_load(),
+    el_torito_get_full_load().
+  * New API call iso_write_opts_set_iso_mbr_part_type().
+
+-------------------------------------------------------------------

Old:
----
  libisofs-1.4.6.tar.gz

New:
----
  libisofs-1.4.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libisofs.spec ++++++
--- /var/tmp/diff_new_pack.CeO9j7/_old  2018-02-09 15:42:18.842662757 +0100
+++ /var/tmp/diff_new_pack.CeO9j7/_new  2018-02-09 15:42:18.842662757 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libisofs
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,22 +18,21 @@
 
 %define so_ver 6
 Name:           libisofs
-Version:        1.4.6
+Version:        1.4.8
 Release:        0
 Summary:        Library for Creating ISO-9660 Filesystems
-License:        GPL-2.0+ and LGPL-2.0+
+License:        GPL-2.0+ AND LGPL-2.0+
 Group:          Productivity/Multimedia/CD/Record
 Url:            http://libburnia-project.org/
 Source0:        
http://files.libburnia-project.org/releases/%{name}-%{version}.tar.gz
 BuildRequires:  doxygen
 BuildRequires:  fdupes
 BuildRequires:  libacl-devel
+BuildRequires:  pkgconfig
+BuildRequires:  zlib-devel
 %if 0%{?suse_version} > 1320 || (0%{?is_opensuse} && 0%{?sle_version} >= 
120300)
 BuildRequires:  libjte-devel
 %endif
-BuildRequires:  pkg-config
-BuildRequires:  zlib-devel
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
 Libisofs is a library for creating ISO-9660 filesystems with extensions like
@@ -85,6 +84,9 @@
 # Remove build time references so build-compare can do its work
 echo "HTML_TIMESTAMP = NO" >> doc/doxygen.conf.in
 
+# Fix rpmlint error "spurious-executable-perm"
+chmod 644 doc/Tutorial
+
 %build
 %configure --disable-static
 make %{?_smp_mflags}
@@ -99,27 +101,24 @@
 # Remove documentation (will be added in /usr/share/doc/packages/)
 rm -rf %{buildroot}%{_datadir}/doc/%{name}-*
 
-# Install devel docs (do it manually to fix also rpmlint warning 
"files-duplicate" with %%fdupes)
+# Install devel docs
 mkdir -p %{buildroot}%{_docdir}/%{name}-devel
-install -pm 0644 AUTHORS COPYING COPYRIGHT ChangeLog NEWS README Roadmap TODO 
%{buildroot}%{_docdir}/%{name}-devel/
-install -pm 0644 
doc/{Tutorial,checksums.txt,susp_aaip_2_0.txt,susp_aaip_isofs_names.txt,zisofs_format.txt}
 %{buildroot}%{_docdir}/%{name}-devel/
 cp -a doc/html/ %{buildroot}%{_docdir}/%{name}-devel/
 
 %fdupes -s %{buildroot}%{_docdir}/%{name}-devel/
 
 %post -n libisofs%{so_ver} -p /sbin/ldconfig
-
 %postun -n libisofs%{so_ver} -p /sbin/ldconfig
 
 %files devel
-%defattr(-,root,root,-)
-%doc %{_docdir}/%{name}-devel/
+%doc AUTHORS COPYING COPYRIGHT ChangeLog NEWS README Roadmap TODO
+%doc 
doc/{Tutorial,checksums.txt,susp_aaip_2_0.txt,susp_aaip_isofs_names.txt,zisofs_format.txt}
+%doc %{_docdir}/%{name}-devel/html/
 %{_includedir}/libisofs/
 %{_libdir}/pkgconfig/libisofs-1.pc
 %{_libdir}/libisofs.so
 
 %files -n libisofs%{so_ver}
-%defattr(-,root,root,-)
 %{_libdir}/libisofs.so.%{so_ver}*
 
 %changelog

++++++ libisofs-1.4.6.tar.gz -> libisofs-1.4.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/COPYRIGHT new/libisofs-1.4.8/COPYRIGHT
--- old/libisofs-1.4.6/COPYRIGHT        2015-07-27 19:58:23.000000000 +0200
+++ new/libisofs-1.4.8/COPYRIGHT        2016-10-07 14:31:40.000000000 +0200
@@ -1,7 +1,9 @@
 Vreixo Formoso <metalpain2...@yahoo.es>,
 Mario Danic <mario.da...@gmail.com>, 
+Vladimir Serbinenko <phco...@gmail.com>
 Thomas Schmitt <scdbac...@gmx.net>
-Copyright (C) 2007-2015 Vreixo Formoso, Mario Danic, Thomas Schmitt
+Copyright (C) 2007-2016
+Vreixo Formoso, Mario Danic, Vladimir Serbinenko, Thomas Schmitt
 
 
     This program is free software; you can redistribute it and/or modify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/ChangeLog new/libisofs-1.4.8/ChangeLog
--- old/libisofs-1.4.6/ChangeLog        2016-09-16 11:07:07.000000000 +0200
+++ new/libisofs-1.4.8/ChangeLog        2017-09-12 11:49:08.000000000 +0200
@@ -1,3 +1,22 @@
+libisofs-1.4.8.tar.gz Tue Sep 12 2017
+===============================================================================
+* Bug fix: iso_read_opts_set_no_rockridge() did not prevent reading of root
+           SUSP.
+* Bug fix: Non-SUSP data in System Use Area prevented image loading if
+           Rock Ridge was enabled. Thanks to Jonathan Dowland.
+* Bug fix: Protective MBR for GPT could emerge with boot flag set.
+* Bug fix: Appended partitions of size >= 4 GiB led to abort with error message
+           "FATAL : ISO overwrite". Thanks to Sven Haardiek.
+* Bug fix: Bit 15 of iso_write_opts_set_system_area did not work with generic
+           MBR.
+* Bug fix: Keeping and patching of loaded boot images failed.
+           Regression by version 1.4.4.
+* Bug fix: Program crashes by intentionally wrong ISO image input.
+           Found by American Fuzzy Lop and Jakub Wilk.
+           Debian bug reports: 872372, 872475, 872545, 872590, 872761.
+* New API calls el_torito_set_full_load(), el_torito_get_full_load().
+* New API call iso_write_opts_set_iso_mbr_part_type().
+
 
 libisofs-1.4.6.tar.gz Fri Sep 16 2016
 ===============================================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/configure new/libisofs-1.4.8/configure
--- old/libisofs-1.4.6/configure        2016-09-16 11:46:21.000000000 +0200
+++ new/libisofs-1.4.8/configure        2017-09-12 12:06:31.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libisofs 1.4.6.
+# Generated by GNU Autoconf 2.69 for libisofs 1.4.8.
 #
 # Report bugs to <http://libburnia-project.org>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='libisofs'
 PACKAGE_TARNAME='libisofs'
-PACKAGE_VERSION='1.4.6'
-PACKAGE_STRING='libisofs 1.4.6'
+PACKAGE_VERSION='1.4.8'
+PACKAGE_STRING='libisofs 1.4.8'
 PACKAGE_BUGREPORT='http://libburnia-project.org'
 PACKAGE_URL=''
 
@@ -1349,7 +1349,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libisofs 1.4.6 to adapt to many kinds of systems.
+\`configure' configures libisofs 1.4.8 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1420,7 +1420,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libisofs 1.4.6:";;
+     short | recursive ) echo "Configuration of libisofs 1.4.8:";;
    esac
   cat <<\_ACEOF
 
@@ -1539,7 +1539,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libisofs configure 1.4.6
+libisofs configure 1.4.8
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2011,7 +2011,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libisofs $as_me 1.4.6, which was
+It was created by libisofs $as_me 1.4.8, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2996,7 +2996,7 @@
 
 # Define the identity of the package.
  PACKAGE='libisofs'
- VERSION='1.4.6'
+ VERSION='1.4.8'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3093,7 +3093,7 @@
 
 LIBISOFS_MAJOR_VERSION=1
 LIBISOFS_MINOR_VERSION=4
-LIBISOFS_MICRO_VERSION=6
+LIBISOFS_MICRO_VERSION=8
 
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
 
 
@@ -3102,10 +3102,10 @@
 
 
 LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
-# 2016.07.01 development jump has not yet happened
-# SONAME = 88 - 82 = 6 . Library name = libisofs.6.82.0
-LT_CURRENT=88
-LT_AGE=82
+# 2017.09.12 development jump has not yet happened
+# SONAME = 90 - 84 = 6 . Library name = libisofs.6.84.0
+LT_CURRENT=90
+LT_AGE=84
 LT_REVISION=0
 LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
 
@@ -13755,7 +13755,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libisofs $as_me 1.4.6, which was
+This file was extended by libisofs $as_me 1.4.8, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13812,7 +13812,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libisofs config.status 1.4.6
+libisofs config.status 1.4.8
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/configure.ac 
new/libisofs-1.4.8/configure.ac
--- old/libisofs-1.4.6/configure.ac     2016-09-16 11:11:23.000000000 +0200
+++ new/libisofs-1.4.8/configure.ac     2017-09-12 11:53:36.000000000 +0200
@@ -1,4 +1,4 @@
-AC_INIT([libisofs], [1.4.6], [http://libburnia-project.org])
+AC_INIT([libisofs], [1.4.8], [http://libburnia-project.org])
 AC_PREREQ([2.50])
 dnl AC_CONFIG_HEADER([config.h])       
 
@@ -41,7 +41,7 @@
 dnl
 LIBISOFS_MAJOR_VERSION=1
 LIBISOFS_MINOR_VERSION=4
-LIBISOFS_MICRO_VERSION=6
+LIBISOFS_MICRO_VERSION=8
 
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
 
 AC_SUBST(LIBISOFS_MAJOR_VERSION)
@@ -51,10 +51,10 @@
 
 dnl Libtool versioning
 LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
-# 2016.07.01 development jump has not yet happened
-# SONAME = 88 - 82 = 6 . Library name = libisofs.6.82.0
-LT_CURRENT=88
-LT_AGE=82
+# 2017.09.12 development jump has not yet happened
+# SONAME = 90 - 84 = 6 . Library name = libisofs.6.84.0
+LT_CURRENT=90
+LT_AGE=84
 LT_REVISION=0
 LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/doc/susp_aaip_isofs_names.txt 
new/libisofs-1.4.8/doc/susp_aaip_isofs_names.txt
--- old/libisofs-1.4.6/doc/susp_aaip_isofs_names.txt    2015-09-24 
15:25:07.000000000 +0200
+++ new/libisofs-1.4.8/doc/susp_aaip_isofs_names.txt    2016-11-13 
09:37:16.000000000 +0100
@@ -4,7 +4,7 @@
                       Directory of Namespace "isofs."
 
           by Thomas Schmitt    - mailto:scdbac...@gmx.net
-          Libburnia project    - mailto:libburn-hack...@pykix.org
+          Libburnia project    - mailto:bug-xorr...@gnu.org
 
 
 The following names are defined for AAIP namespace "isofs." as mentioned in
@@ -227,7 +227,7 @@
 Copyright (c) 2009 - 2011 Thomas Schmitt <scdbac...@gmx.net>
 It shall only be modified in sync with libisofs and other software which
 makes use of AAIP. Please mail change requests to mailing list
-<libburn-hack...@pykix.org> or to the copyright holder in private.
+<bug-xorr...@gnu.org> or to the copyright holder in private.
 Only if you cannot reach the copyright holder for at least one month it is
 permissible to modify this text under the same license as the affected
 copy of libisofs.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/ecma119.c 
new/libisofs-1.4.8/libisofs/ecma119.c
--- old/libisofs-1.4.6/libisofs/ecma119.c       2016-09-13 19:36:14.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/ecma119.c       2017-08-24 15:35:39.000000000 
+0200
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2007 Vreixo Formoso
  * Copyright (c) 2007 Mario Danic
- * Copyright (c) 2009 - 2016 Thomas Schmitt
+ * Copyright (c) 2009 - 2017 Thomas Schmitt
  *
  * This file is part of the libisofs project; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 2 
@@ -1417,6 +1417,7 @@
       target->partiton_offset from any LBA pointer.
     */
     target->eff_partition_offset = target->opts->partition_offset;
+    target->pvd_size_is_total_size = 0;
     for (i = 0; i < (int) target->nwriters; ++i) {
         writer = target->writers[i];
         /* Not all writers have an entry in the partion volume descriptor set.
@@ -1497,9 +1498,6 @@
 }
 
 
-/* >>> need opportunity to just mark a partition in the older sessions
-*/
-
 
 struct iso_interval_zeroizer {
     int z_type; /* 0= $zero_start"-"$zero_end ,
@@ -2000,6 +1998,50 @@
 }
 
 
+/* Tells whether ivr is a reader from imported_iso in a multi-session
+   add-on situation, and thus to be kept in place.
+*/
+int iso_interval_reader_keep(Ecma119Image *target, 
+                             struct iso_interval_reader *ivr,
+                             int flag)
+{
+    /* Source must be "imported_iso" */
+    if (!(ivr->flags & 1))
+        return 0;
+
+    /* It must not be a new ISO */
+    if (!target->opts->appendable)
+        return 0;
+
+    /* --- From here on return either 1 or <0 --- */
+
+    /* multi-session write offset must be larger than interval end */
+    if (target->opts->ms_block <= ivr->end_byte / BLOCK_SIZE)
+        return ISO_MULTI_OVER_IMPORTED;
+
+    return 1;
+}
+
+
+int iso_interval_reader_start_size(Ecma119Image *t, char *path,
+                                   off_t *start_byte, off_t *byte_count,
+                                   int flag)
+{
+    struct iso_interval_reader *ivr;
+    int keep, ret;
+
+    ret = iso_interval_reader_new(t->image, path, &ivr, byte_count, 0);
+    if (ret < 0)
+        return ret;
+    *start_byte = ivr->start_byte;
+    keep = iso_interval_reader_keep(t, ivr, 0);
+    if (keep < 0)
+        return(keep);
+    iso_interval_reader_destroy(&ivr, 0);
+    return ISO_SUCCESS + (keep > 0);
+}
+
+
 int iso_write_partition_file(Ecma119Image *target, char *path,
                              uint32_t prepad, uint32_t blocks, int flag)
 {
@@ -2025,6 +2067,14 @@
                                       &ivr, &byte_count, 0);
         if (ret < 0)
             goto ex;
+        ret = iso_interval_reader_keep(target, ivr, 0);
+        if (ret < 0)
+            goto ex;
+        if (ret > 0) {
+            /* From imported_iso and for add-on session. Leave it in place. */
+            ret = ISO_SUCCESS;
+            goto ex;
+        }
         for (i = 0; i < blocks; i++) {
             ret = iso_interval_reader_read(ivr, buf, &buf_fill, 0);
             if (ret < 0)
@@ -3482,6 +3532,7 @@
     wopts->appended_as_gpt = 0;
     wopts->appended_as_apm = 0;
     wopts->part_like_isohybrid = 0;
+    wopts->iso_mbr_part_type = -1;
     wopts->ascii_disc_label[0] = 0;
     wopts->will_cancel = 0;
     wopts->allow_dir_id_ext = 0;
@@ -4217,6 +4268,14 @@
     return ISO_SUCCESS;
 }
 
+int iso_write_opts_set_iso_mbr_part_type(IsoWriteOpts *opts, int part_type)
+{
+    if (part_type < -1 || part_type > 255)
+        part_type = -1;
+    opts->iso_mbr_part_type = part_type;
+    return ISO_SUCCESS;
+}
+
 int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
 {
     strncpy(opts->ascii_disc_label, label, ISO_DISC_LABEL_SIZE - 1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/ecma119.h 
new/libisofs-1.4.8/libisofs/ecma119.h
--- old/libisofs-1.4.6/libisofs/ecma119.h       2016-08-11 15:01:43.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/ecma119.h       2017-08-17 19:26:55.000000000 
+0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2007 Vreixo Formoso
- * Copyright (c) 2009 - 2015 Thomas Schmitt
+ * Copyright (c) 2009 - 2017 Thomas Schmitt
  *
  * This file is part of the libisofs project; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 2 
@@ -496,6 +496,14 @@
      */
     int part_like_isohybrid;
 
+    /* The type to use for the mountable ISO partition if there is any and if
+       the type is not mandatorily determined for particular circumstances like
+       compliant GPT, CHRP, or PReP.
+       -1 = use the default value (e.g. 0xcd, 0x83, 0x17)
+       0x00 to 0xff = value to use if possible 
+    */
+    int iso_mbr_part_type;
+
     /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
      */
     char ascii_disc_label[ISO_DISC_LABEL_SIZE];
@@ -1024,5 +1032,18 @@
 
 void issue_ucs2_warning_summary(size_t failures);
 
+/* Tells whether ivr is a reader from imported_iso in a multi-session
+   add-on situation, and thus to be kept in place.
+*/
+int iso_interval_reader_keep(Ecma119Image *target,
+                             struct iso_interval_reader *ivr,
+                             int flag);
+
+/* @return: ISO_SUCCESS = ok, ISO_SUCCESS + 1 = keep , < 0 = error */
+int iso_interval_reader_start_size(Ecma119Image *t, char *path,
+                                   off_t *start_byte, off_t *byte_count,
+                                   int flag);
+
+
 
 #endif /*LIBISO_ECMA119_H_*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/eltorito.c 
new/libisofs-1.4.8/libisofs/eltorito.c
--- old/libisofs-1.4.6/libisofs/eltorito.c      2016-08-06 10:12:56.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/eltorito.c      2017-07-02 15:08:34.000000000 
+0200
@@ -113,9 +113,24 @@
 /* API */
 int el_torito_get_load_size(ElToritoBootImage *bootimg)
 {
-   return (int) bootimg->load_size;
+    return (int) bootimg->load_size;
 }
 
+/* API */
+void el_torito_set_full_load(ElToritoBootImage *bootimg, int mode)
+{
+    if (bootimg->type != 0)
+        return;
+    bootimg->load_size_full= !!mode;
+}
+
+/* API */
+int el_torito_get_full_load(ElToritoBootImage *bootimg)
+{
+    return bootimg->load_size_full;
+}
+
+
 /**
  * Marks the specified boot image as not bootable
  */
@@ -513,6 +528,7 @@
     boot->partition_type = partition_type;
     boot->load_seg = 0;
     boot->load_size = load_sectors;
+    boot->load_size_full = 0;
     boot->platform_id = 0; /* 80x86 */
     memset(boot->id_string, 0, sizeof(boot->id_string));
     memset(boot->selection_crit, 0, sizeof(boot->selection_crit));
@@ -887,6 +903,32 @@
            sizeof(e->id_string));
 }
 
+static int
+write_section_load_size(struct el_torito_boot_image *img,
+                        struct el_torito_section_entry *se,
+                        uint16_t load_size, off_t full_byte_size, int flag)
+{
+    uint16_t size;
+    off_t blocks;
+
+    size= load_size;
+    if(img->type == 0 && img->load_size_full) {
+        blocks= ((full_byte_size + 2047) / 2048) * 4;
+        if (blocks > 65535) {
+            if (img->platform_id == 0xef)
+                size= 0;
+            else
+                size= 65535;
+        } else if(blocks <= 0) {
+            size= 1;
+        } else {
+            size= blocks;
+        }
+    }
+    iso_lsb(se->sec_count, size, 2);
+    return(1);
+}
+
 /**
  * Write one section entry.
  * Usable for the Default Entry
@@ -930,6 +972,8 @@
             return ISO_BOOT_IMAGE_NOT_VALID;
         }
 
+        /* >>> check for non-automatic load size */;
+
         if (t->boot_intvl_size[idx] > 65535) {
             if (img->platform_id == 0xef)
                 iso_lsb(se->sec_count, 0, 2);
@@ -946,6 +990,9 @@
         iso_lsb(se->block, t->boot_intvl_start[idx], 4);
     } else if (mode == 2) {
         app_idx = t->boot_appended_idx[idx];
+
+        /* >>> check for non-automatic load size */;
+
         if (t->appended_part_size[app_idx] * 4 > 65535) {
             if (img->platform_id == 0xef)
                 iso_lsb(se->sec_count, 0, 2);
@@ -956,7 +1003,8 @@
         }
         iso_lsb(se->block, t->appended_part_start[app_idx], 4);
     } else {
-        iso_lsb(se->sec_count, img->load_size, 2);
+        write_section_load_size(img, se, (uint16_t) img->load_size,
+                                (off_t) t->bootsrc[idx]->sections[0].size, 0);
         iso_lsb(se->block, t->bootsrc[idx]->sections[0].block, 4);
     }
 
@@ -1457,11 +1505,6 @@
                               target->catalog->bootimages[idx]->appended_start;
             target->boot_intvl_size[idx] =
                                target->catalog->bootimages[idx]->appended_size;
-            if (((target->system_area_options >> 2) & 0x3f) == 0 &&
-                (target->system_area_options & 3) == 1) {
-                /* ISO will not be a partition. It can span the whole image. */
-                target->pvd_size_is_total_size = 1;
-            }
     continue;
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/eltorito.h 
new/libisofs-1.4.8/libisofs/eltorito.h
--- old/libisofs-1.4.6/libisofs/eltorito.h      2016-01-07 15:12:27.000000000 
+0100
+++ new/libisofs-1.4.8/libisofs/eltorito.h      2016-11-09 11:01:47.000000000 
+0100
@@ -85,6 +85,7 @@
     unsigned char partition_type; /**< type of partition for HD-emul images */
     uint16_t load_seg; /**< Load segment for the initial boot image. */
     uint16_t load_size; /**< Number of sectors to load. */
+    int load_size_full; /* 1= override load_size by image size */
 
     /* Byte 1 of Validation Entry or Section Header Entry:
        0= 80x86, 1= PowerPC, 2= Mac, 0xef= EFI */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/fs_image.c 
new/libisofs-1.4.8/libisofs/fs_image.c
--- old/libisofs-1.4.6/libisofs/fs_image.c      2016-07-22 14:33:41.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/fs_image.c      2017-09-08 09:45:44.000000000 
+0200
@@ -326,6 +326,11 @@
     int aaip_version;
 
     /**
+     * Start block of loaded session.
+     */
+    uint32_t session_lba;
+
+    /**
      * Number of blocks of the volume, as reported in the PVM.
      */
     uint32_t nblocks;
@@ -371,7 +376,7 @@
        bit3= Invalid NM entry
        bit4= New SL entry found without previous CONTINUE flag
        bit5= Invalid SL entry
-       bit6= Invalid SL entry, no child location
+       bit6= Invalid CL entry, no child location / found in CL target
        bit7= Invalid PN entry
        bit8= Sparse files not supported
        bit9= SP entry found in a directory entry other than '.' entry of root
@@ -384,6 +389,7 @@
       bit16= Incomplete SL
       bit17= Charset conversion error
       bit18= Link without destination
+      bit19= SL with a non-link file
     */
     int rr_err_reported;
     int rr_err_repeated;
@@ -1415,6 +1421,7 @@
  * @param flag
  *      bit0= this is the root node attribute load call
  *            (parameter parent is not reliable for this)
+ *      bit1= this is a call caused by CL. Do not obey CL again.
  * @return
  *      2 node is still incomplete (multi-extent)
  *      1 success, 0 record ignored (not an error, can be a relocated dir),
@@ -1576,13 +1583,14 @@
         SuspIterator *iter;
 
 
-        iter = susp_iter_new(fsdata->src, record, fsdata->len_skp,
-                             fsdata->msgid);
+        iter = susp_iter_new(fsdata->src, record,
+                             fsdata->session_lba + fsdata->nblocks,
+                             fsdata->len_skp, fsdata->msgid);
         if (iter == NULL) {
             {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)
@@ -1699,7 +1707,17 @@
                  */
                 susp_iter_free(iter);
                 free(name);
+                if (flag & 1) {
+                    ret = iso_rr_msg_submit(fsdata, 3, ISO_NO_ROOT_DIR, 0,
+                           "Root directory is marked by RRIP RE as relocated");
+                    ret= ISO_NO_ROOT_DIR;
+                    goto ex;
+                }
                 {ret = 0; goto ex;} /* it's not an error */
+            } else if (SUSP_SIG(sue, 'C', 'L') && (flag & 2)) {
+                ret = iso_rr_msg_submit(fsdata, 6, ISO_WRONG_RR, 0,
+                                       "Invalid CL entry, found in CL target");
+
             } else if (SUSP_SIG(sue, 'C', 'L')) {
                 /*
                  * This entry is a placeholder for a relocated dir.
@@ -1710,7 +1728,7 @@
                 relocated_dir = iso_read_bb(sue->data.CL.child_loc, 4, NULL);
                 if (relocated_dir == 0) {
                     ret = iso_rr_msg_submit(fsdata, 6, ISO_WRONG_RR, 0,
-                                  "Invalid SL entry, no child location");
+                                  "Invalid CL entry, no child location");
                     break;
                 }
             } else if (SUSP_SIG(sue, 'P', 'N')) {
@@ -1979,14 +1997,17 @@
             goto ex;
         }
 
+        /* Call with flag bit1 to prevent further CL relocation */
         ret = iso_file_source_new_ifs(fs, parent, (struct ecma119_dir_record*)
-                                      buffer, src, 0);
+                                      buffer, src, flag | 2);
         if (ret <= 0) {
             goto ex;
         }
 
         /* but the real name is the name of the placeholder */
         ifsdata = (ImageFileSourceData*) (*src)->data;
+        if (ifsdata->name != NULL)
+            free(ifsdata->name);
         ifsdata->name = name;
 
         {ret = ISO_SUCCESS; goto ex;}
@@ -2087,6 +2108,11 @@
 
     if (S_ISLNK(atts.st_mode)) {
         ifsdata->data.content = linkdest;
+    } else if (linkdest != NULL) {
+        ret = iso_rr_msg_submit(fsdata, 19, ISO_WRONG_RR_WARN, 0,
+                     "RRIP SL link destination with file that is not a link.");
+        free(linkdest);
+        linkdest = NULL;
     }
 
     ifsrc->class = &ifs_class;
@@ -2392,13 +2418,14 @@
      * In that case, we need to set info->len_skp to 15!!
      */
 
-    iter = susp_iter_new(data->src, record, data->len_skp, data->msgid);
+    iter = susp_iter_new(data->src, record, data->session_lba + data->nblocks,
+                         data->len_skp, data->msgid);
     if (iter == NULL) {
         ret = ISO_OUT_OF_MEM; goto ex;
     }
 
     /* 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 +2469,7 @@
      * 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)
@@ -2589,6 +2616,9 @@
     data->effective_time =
             iso_util_strcopy_untail((char*) pvm->vol_effective_time, 17);
 
+    data->session_lba = 0;
+    if (block >= 16) /* The session begins 16 blocks before the PVD */
+        data->session_lba = block - 16;
     data->nblocks = iso_read_bb(pvm->vol_space_size, 4, NULL);
 
     rootdr = (struct ecma119_dir_record*) pvm->root_dir_record;
@@ -2641,14 +2671,6 @@
         {ret = ISO_WRONG_EL_TORITO; goto ex;}
     }
 
-    /* check for a valid platform */
-    if (ve->platform_id[0] != 0 && ve->platform_id[0] != 0xef) {
-        iso_msg_submit(data->msgid, ISO_UNSUPPORTED_EL_TORITO, 0,
-                     "Unsupported El-Torito platform. Only 80x86 and EFI are "
-                     "supported. El-Torito info will be ignored.");
-        {ret = ISO_UNSUPPORTED_EL_TORITO; goto ex;}
-    }
-
     /* ok, once we are here we assume it is a valid catalog */
 
     /* parse the default entry */
@@ -3017,15 +3039,14 @@
     } while (buffer[0] != 255);
 
     /* 4. check if RR extensions are being used */
-    ret = read_root_susp_entries(data, data->pvd_root_block);
-    if (ret < 0) {
-        goto fs_cleanup;
-    }
-
-    /* user doesn't want to read RR extensions */
     if (opts->norock) {
+        /* user doesn't want to read RR extensions */
         data->rr = RR_EXT_NO;
     } else {
+        ret = read_root_susp_entries(data, data->pvd_root_block);
+        if (ret < 0) {
+            goto fs_cleanup;
+        }
         data->rr = data->rr_version;
     }
 
@@ -3906,10 +3927,12 @@
 
 static
 int iso_analyze_partition_offset(IsoImage *image, IsoDataSource *src,
-                                 uint64_t start_block, int flag)
+                                 uint64_t start_block, uint64_t block_count,
+                                 int flag)
 {
     int ret;
     uint8_t *buf = NULL;
+    uint32_t iso_size;
     off_t p_offset;
     struct ecma119_pri_vol_desc *pvm;
     struct iso_imported_sys_area *sai;
@@ -3922,11 +3945,14 @@
     ret = src->read_block(src, p_offset + 16, buf);
     if (ret > 0) {
         pvm = (struct ecma119_pri_vol_desc *) buf;
+        iso_size = iso_read_lsb(pvm->vol_space_size, 4);
         if (strncmp((char*) pvm->std_identifier, "CD001", 5) == 0 &&
             pvm->vol_desc_type[0] == 1 &&
             pvm->vol_desc_version[0] == 1 &&
             pvm->file_structure_version[0] == 1 &&
-            iso_read_lsb(pvm->vol_space_size, 4) + p_offset == sai->image_size)
+            (iso_size + p_offset == sai->image_size ||
+             iso_size == block_count / 4))
+
             sai->partition_offset = p_offset;
     }
     ret = 1;
@@ -4035,10 +4061,10 @@
             part->start_block >= 64 && part->block_count >= 72 &&
             part->start_block <= 2048 &&
             part->start_block % 4 == 0 && part->block_count % 4 == 0 &&
-            (part->start_block + part->block_count) / 4 == sai->image_size) {
+            (part->start_block + part->block_count) / 4 <= sai->image_size) {
 
             ret = iso_analyze_partition_offset(image, src, part->start_block,
-                                               0);
+                                               part->block_count, 0);
             if (ret < 0)
                 goto ex;
         }
@@ -4343,10 +4369,10 @@
             block_count = sai->gpt_req[0]->block_count;
             if (start_block >= 64 && block_count >= 72 &&
                 start_block <= 2048 && start_block % 4 == 0 &&
-                block_count % 4 == 0 &&
-                (start_block + block_count) / 4 == sai->image_size) {
+                block_count % 4 == 0) {
 
-                ret = iso_analyze_partition_offset(image, src, start_block, 0);
+                ret = iso_analyze_partition_offset(image, src, start_block,
+                                                   block_count, 0);
                 if (ret < 0)
                     return ret;
             }
@@ -4975,12 +5001,13 @@
     if (sa_type == 0) {
         if ((sao & 3) || sa_sub == 1 || sa_sub == 2) {
             strcat(msg, " MBR");
-            if (sao & 1)
-                strcat(msg, " protective-msdos-label");
-            else if (sao & 2)
+            if (sao & 2)
                 strcat(msg, " isohybrid");
-            else if (sa_sub == 1)
+            else if (sao & 1)
+                strcat(msg, " protective-msdos-label");
+            else if (sa_sub == 1) {
                 strcat(msg, " CHRP");
+            }
             if ((sao & (1 << 14)) && !(sao & 2))
                 strcat(msg, " grub2-mbr");
             sprintf(msg + strlen(msg), " cyl-align-%s",
@@ -5738,6 +5765,10 @@
         iso_filesystem_unref(fs);
         return ret;
     }
+    if (newroot == NULL) {
+        iso_filesystem_unref(fs);
+        return ISO_NO_ROOT_DIR;
+    }
 
     /* Lookup character set even if no AAIP loading is enabled */
     ret = iso_file_source_get_aa_string(newroot, &aa_string, 2);
@@ -5853,6 +5884,7 @@
             boot_image->platform_id = data->platform_ids[idx];
             memcpy(boot_image->id_string, data->id_strings[idx], 28);
             memcpy(boot_image->selection_crit, data->selection_crits, 20);
+            boot_image->appended_idx = -1;
 
             catalog->bootimages[catalog->num_bootimages] = boot_image;
             boot_image = NULL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/libisofs.h 
new/libisofs-1.4.8/libisofs/libisofs.h
--- old/libisofs-1.4.6/libisofs/libisofs.h      2016-09-16 11:44:45.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/libisofs.h      2017-09-12 11:54:27.000000000 
+0200
@@ -4,7 +4,7 @@
 
 /*
  * Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
- * Copyright (c) 2009-2016 Thomas Schmitt
+ * Copyright (c) 2009-2017 Thomas Schmitt
  *
  * This file is part of the libisofs project; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 2 
@@ -94,7 +94,7 @@
  */
 #define iso_lib_header_version_major  1
 #define iso_lib_header_version_minor  4
-#define iso_lib_header_version_micro  6
+#define iso_lib_header_version_micro  8
 
 /**
  * Get version of the libisofs library at runtime.
@@ -2749,6 +2749,21 @@
  */
 int iso_write_opts_set_part_like_isohybrid(IsoWriteOpts *opts, int alike);
 
+/**
+ * Set the partition type of the MBR partition which represents the ISO
+ * filesystem or at least protects it.
+ * This is without effect if no such partition emerges by other settings or
+ * if the partition type is prescribed mandatorily like 0xee for GPT protective
+ * MBR or 0x96 for CHRP.
+ * @param opts
+ *        The option set to be manipulated.
+ * @param part_type
+ *        0x00 to 0xff as desired partition type.
+ *        Any other value (e.g. -1) enables the default types of the various
+ *        occasions.
+ * @since 1.4.8
+ */
+int iso_write_opts_set_iso_mbr_part_type(IsoWriteOpts *opts, int part_type);
 
 /**
  * Inquire the start address of the file data blocks after having used
@@ -3837,6 +3852,26 @@
 int el_torito_get_load_size(ElToritoBootImage *bootimg);
 
 /**
+ * State that the load size shall be the size of the boot image automatically.
+ * This overrides el_torito_set_load_size().
+ * @param bootimg
+ *      The image to to manipulate
+ * @param mode
+ *      0= use value of el_torito_set_load_size()
+ *      1= determine value from boot image
+ */
+void el_torito_set_full_load(ElToritoBootImage *bootimg, int mode);
+
+/**
+ * Inquire the setting of el_torito_set_full_load().
+ * @param bootimg
+ *      The image to inquire
+ * @return
+ *      The mode set with el_torito_set_full_load().
+ */
+int el_torito_get_full_load(ElToritoBootImage *bootimg);
+
+/**
  * Marks the specified boot image as not bootable
  *
  * @since 0.6.2
@@ -8845,6 +8880,17 @@
                                                        (FAILURE, HIGH, -417) */
 #define ISO_BAD_GPT_GUID_MODE       0xE830FE5F
 
+/** Unable to obtain root directory                       (FATAL,HIGH, -418) */
+#define ISO_NO_ROOT_DIR             0xF030FE5E
+
+/** Zero sized, oversized, or mislocated SUSP CE area found
+                                                       (FAILURE, HIGH, -419) */
+#define ISO_SUSP_WRONG_CE_SIZE      0xE830FE5D
+
+/** Multi-session would overwrite imported_iso interval
+                                                       (FAILURE, HIGH, -420) */
+#define ISO_MULTI_OVER_IMPORTED     0xE830FE5C
+
 
 /* Internal developer note: 
    Place new error codes directly above this comment. 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/libisofs.ver 
new/libisofs-1.4.8/libisofs/libisofs.ver
--- old/libisofs-1.4.6/libisofs/libisofs.ver    2016-08-10 21:35:13.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/libisofs.ver    2017-02-26 17:01:57.000000000 
+0100
@@ -5,6 +5,7 @@
 el_torito_get_bootable;
 el_torito_get_boot_media_type;
 el_torito_get_boot_platform_id;
+el_torito_get_full_load;
 el_torito_get_id_string;
 el_torito_get_isolinux_options;
 el_torito_get_load_seg;
@@ -13,6 +14,7 @@
 el_torito_patch_isolinux_image;
 el_torito_seems_boot_info_table;
 el_torito_set_boot_platform_id;
+el_torito_set_full_load;
 el_torito_set_id_string;
 el_torito_set_isolinux_options;
 el_torito_set_load_seg;
@@ -328,6 +330,7 @@
 iso_write_opts_set_hfsplus;
 iso_write_opts_set_iso1999;
 iso_write_opts_set_iso_level;
+iso_write_opts_set_iso_mbr_part_type;
 iso_write_opts_set_joliet;
 iso_write_opts_set_joliet_long_names;
 iso_write_opts_set_joliet_longer_paths;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/messages.c 
new/libisofs-1.4.8/libisofs/messages.c
--- old/libisofs-1.4.6/libisofs/messages.c      2016-08-11 14:17:56.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/messages.c      2017-08-24 15:33:38.000000000 
+0200
@@ -547,6 +547,12 @@
         return "Cannot derive GPT GUID from undefined pseudo-UUID volume 
timestamp";
     case ISO_BAD_GPT_GUID_MODE:
         return "Unrecognized GPT disk GUID setup mode";
+    case ISO_NO_ROOT_DIR:
+        return "Unable to obtain root directory";
+    case ISO_SUSP_WRONG_CE_SIZE:
+        return "Zero sized, oversized, or mislocated SUSP CE area found";
+    case ISO_MULTI_OVER_IMPORTED:
+        return "Multi-session would overwrite imported_iso interval";
     default:
         return "Unknown error";
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/rockridge.h 
new/libisofs-1.4.8/libisofs/rockridge.h
--- old/libisofs-1.4.6/libisofs/rockridge.h     2015-10-09 12:18:41.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/rockridge.h     2017-08-19 15:59:50.000000000 
+0200
@@ -254,7 +254,7 @@
 
 SuspIterator *
 susp_iter_new(IsoDataSource *src, struct ecma119_dir_record *record, 
-              uint8_t len_skp, int msgid);
+              uint32_t fs_blocks, uint8_t len_skp, int msgid);
 
 /**
  * Get the next SUSP System User Entry using given iterator.
@@ -266,7 +266,8 @@
  * @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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/rockridge_read.c 
new/libisofs-1.4.8/libisofs/rockridge_read.c
--- old/libisofs-1.4.6/libisofs/rockridge_read.c        2015-10-08 
23:18:39.000000000 +0200
+++ new/libisofs-1.4.8/libisofs/rockridge_read.c        2017-08-21 
12:29:12.000000000 +0200
@@ -35,6 +35,9 @@
     IsoDataSource *src;
     int msgid;
 
+    /* Number of blocks in the ISO 9660 filesystem */
+    uint32_t fs_blocks;
+
     /* block and offset for next continuation area */
     uint32_t ce_block;
     uint32_t ce_off;
@@ -47,7 +50,7 @@
 
 SuspIterator*
 susp_iter_new(IsoDataSource *src, struct ecma119_dir_record *record,
-              uint8_t len_skp, int msgid)
+              uint32_t fs_blocks, uint8_t len_skp, int msgid)
 {
     int pad = (record->len_fi[0] + 1) % 2;
     struct susp_iterator *iter = malloc(sizeof(struct susp_iterator));
@@ -60,6 +63,7 @@
     iter->size = record->len_dr[0] - record->len_fi[0] - 33 - pad;
     iter->src = src;
     iter->msgid = msgid;
+    iter->fs_blocks = fs_blocks;
 
     iter->ce_len = 0;
     iter->buffer = NULL;
@@ -67,12 +71,30 @@
     return iter;
 }
 
-int susp_iter_next(SuspIterator *iter, struct susp_sys_user_entry **sue)
+/* More than 1 MiB in a single file's CE area is suspicious */
+#define ISO_SUSP_MAX_CE_BYTES (1024 * 1024)
+
+
+/* @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'))) {
 
         /* 
@@ -81,22 +103,31 @@
          * (IEEE 1281, SUSP. section 4) 
          */
         if (iter->ce_len) {
-            uint32_t block, nblocks;
+            uint32_t block, nblocks, skipped_blocks, skipped_bytes;
 
-            /* A CE has found, there is another continuation area */
-            nblocks = DIV_UP(iter->ce_off + iter->ce_len, BLOCK_SIZE);
+            /* A CE was found, there is another continuation area */
+            skipped_blocks = iter->ce_off / BLOCK_SIZE;
+            skipped_bytes = skipped_blocks * BLOCK_SIZE;
+            nblocks = DIV_UP(iter->ce_off - skipped_bytes + iter->ce_len,
+                             BLOCK_SIZE);
+            if (nblocks <= 0 || iter->ce_len > ISO_SUSP_MAX_CE_BYTES)
+                return ISO_SUSP_WRONG_CE_SIZE;
+            if (((uint64_t) iter->ce_block) + skipped_blocks + nblocks >
+                (uint64_t) iter->fs_blocks)
+                return ISO_SUSP_WRONG_CE_SIZE;
             iter->buffer = realloc(iter->buffer, nblocks * BLOCK_SIZE);
 
-            /* read all blocks needed to cache the full CE */
+            /* Read blocks needed to cache the given CE area range */
             for (block = 0; block < nblocks; ++block) {
                 int ret;
-                ret = iter->src->read_block(iter->src, iter->ce_block + block,
-                                            iter->buffer + block * BLOCK_SIZE);
+                ret = iter->src->read_block(iter->src,
+                                       iter->ce_block + skipped_blocks + block,
+                                       iter->buffer + block * BLOCK_SIZE);
                 if (ret < 0) {
                     return ret;
                 }
             }
-            iter->base = iter->buffer + iter->ce_off;
+            iter->base = iter->buffer + (iter->ce_off - skipped_bytes);
             iter->pos = 0;
             iter->size = iter->ce_len;
             iter->ce_len = 0;
@@ -134,10 +165,10 @@
         }
 
         /* 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;
@@ -374,12 +405,18 @@
         if (*cont == 1) {
             /* new component */
             size_t size = strlen(*dest);
+            int has_slash;
+
             *dest = realloc(*dest, strlen(*dest) + len + 2);
             if (*dest == NULL) {
                 return ISO_OUT_OF_MEM;
             }
             /* it is a new compoenent, add the '/' */
-            if ((*dest)[size-1] != '/') {
+            has_slash = 0;
+            if (size > 0)
+                if ((*dest)[size - 1] == '/')
+                    has_slash = 1;
+            if (!has_slash) {
                 (*dest)[size] = '/';
                 (*dest)[size+1] = '\0';
             }
@@ -462,24 +499,27 @@
      if (*is_done) {
 
          /* To coexist with Apple ISO :
-            Gracefully react on eventually trailing Apple AA
+            Gracefully react on possibly trailing Apple AA
          */
          if (sue->version[0] != 1 || sue->len_sue[0] == 7)
              return ISO_SUCCESS;
 
          return ISO_WRONG_RR;
      }
-
-
-     /* Eventually create or grow storage */
      if (*aa_size == 0 || *aa_string == NULL) {
-
-         /* Gracefully react on eventually leading Apple AA
+         /* Gracefully react on possibly leading Apple AA
          */
-         if (sue->version[0] != 1 || sue->len_sue[0] < 9) {
+         if (sue->version[0] != 1 || sue->len_sue[0] < 9)
              return ISO_SUCCESS;
-         }
+     }
 
+     /* A valid AAIP AA entry has 5 header bytes and at least 1 component byte
+      */
+     if (sue->len_sue[0] < 6)
+         return ISO_WRONG_RR;
+
+     /* Possibly create or grow storage */
+     if (*aa_size == 0 || *aa_string == NULL) {
          *aa_size = *aa_len + sue->len_sue[0];
          *aa_string = calloc(*aa_size, 1);
          *aa_len = 0;
@@ -535,7 +575,12 @@
      if (sue->version[0] != 1)
          return ISO_WRONG_RR;
 
-     /* Eventually create or grow storage */
+     /* A valid AL entry has 5 header bytes and at least 1 component byte
+      */
+     if (sue->len_sue[0] < 6)
+         return ISO_WRONG_RR;
+
+     /* Possibly create or grow storage */
      if (*aa_size == 0 || *aa_string == NULL) {
          *aa_size = *aa_len + sue->len_sue[0];
          *aa_string = calloc(*aa_size, 1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libisofs-1.4.6/libisofs/system_area.c 
new/libisofs-1.4.8/libisofs/system_area.c
--- old/libisofs-1.4.6/libisofs/system_area.c   2016-08-14 21:19:58.000000000 
+0200
+++ new/libisofs-1.4.8/libisofs/system_area.c   2017-08-24 15:39:28.000000000 
+0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2008 Vreixo Formoso
- * Copyright (c) 2010 - 2016 Thomas Schmitt
+ * Copyright (c) 2010 - 2017 Thomas Schmitt
  *
  * This file is part of the libisofs project; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 2 
@@ -108,11 +108,14 @@
 }
 
 /* @param flag bit0= The path contains instructions for the interval reader
+   @return ISO_SUCCESS     = ok, partition will be written
+           ISO_SUCCESS + 1 = interval which shall be kept in place
+           else : error code
 */
 static int compute_partition_size(Ecma119Image *t, char *disk_path,
                                   uint32_t *size, int flag)
 {
-    int ret;
+    int ret, keep;
     off_t num;
     struct stat stbuf;
     struct iso_interval_reader *ivr;
@@ -124,8 +127,11 @@
         if (ret < 0)
             return ret;
         *size = (byte_count + BLOCK_SIZE - 1) / BLOCK_SIZE;
+        keep = iso_interval_reader_keep(t, ivr, 0);
         iso_interval_reader_destroy(&ivr, 0);
-        return ISO_SUCCESS;
+        if (keep < 0)
+            return keep;
+        return ISO_SUCCESS + (keep > 0);
     }
 
     *size = 0;
@@ -148,6 +154,7 @@
 {
     int ret, i, sa_type, cyl_align, cyl_size = 0;
     uint32_t pos, size, add_pos = 0;
+    off_t start_byte, byte_count;
 
     sa_type = (t->system_area_options >> 2) & 0x3f;
     cyl_align = (t->system_area_options >> 8) & 0x3;
@@ -168,6 +175,20 @@
                                      t->opts->appended_part_flags[i]);
         if (ret < 0)
             return ret;
+        if (ret == ISO_SUCCESS + 1) {
+            /* Interval from imported_iso in add-on session */
+            t->appended_part_prepad[i] = 0;
+            ret = iso_interval_reader_start_size(t,
+                                               t->opts->appended_partitions[i],
+                                               &start_byte, &byte_count, 0);
+            if (ret < 0)
+                return ret;
+            t->appended_part_start[i] = start_byte / 2048;
+            t->appended_part_size[i] = size;
+            t->opts->iso_mbr_part_type = 0;
+    continue;
+        }
+
         add_pos = 0;
         if (sa_type == 3 && (pos % ISO_SUN_CYL_SIZE)) {
             add_pos = ISO_SUN_CYL_SIZE - (pos % ISO_SUN_CYL_SIZE);
@@ -184,7 +205,7 @@
         }
         t->appended_part_size[i] = size;
         pos += add_pos + size;
-        t->total_size += (add_pos + size) * 2048;
+        t->total_size += (((off_t) add_pos) + size) * 2048;
         if (flag & 1)
             t->curblock = pos;
     }
@@ -192,6 +213,19 @@
 }
 
 
+static int mbr_part_slot_is_unused(uint8_t *slot)
+{
+    int i;
+
+    for (i = 0; i < 16; i++)
+        if (slot[i] != 0)
+    break;
+    if (i >= 16)
+        return 1;
+    return 0;
+}
+
+
 /* @param flag
                 bit1= partition_offset and partition_size are counted in
                       blocks of 512 rather than 2048
@@ -287,7 +321,7 @@
         buf[510] = 0x55;
         buf[511] = 0xAA;
     }
-    if (!(flag & 2)) {
+    if ((!(flag & 2)) && part_type != 0xee && part_type != 0xef) {
       /* 3) Put 0x80 (for bootable partition), */
       *(wpt++) = 0x80;
     } else {
@@ -1777,7 +1811,7 @@
                               0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 };
 
     for (i = 0; i < 4; i++) {
-        if (buf[446 + 16 * i + 4] == 0x00) {
+        if (mbr_part_slot_is_unused(buf + 446 + 16 * i)) {
             memcpy(buf + 446 + 16 * i, dummy_entry, 16);
             return;
         }
@@ -1918,6 +1952,9 @@
                 pml_blocks = gpt_blocks;
             } else {
                 part_type = 0xcd;
+                if (t->opts->iso_mbr_part_type >= 0 &&
+                    t->opts->iso_mbr_part_type <= 255)
+                    part_type= t->opts->iso_mbr_part_type;
                 pml_blocks = img_blocks;
             }
             ret = make_grub_msdos_label(pml_blocks, t->partition_secs_per_head,
@@ -1942,8 +1979,12 @@
 
         if (gpt_count > 0 || apm_count > 0)
             part_type = 0x00;
-        else
+        else {
             part_type = 0x17;
+            if (t->opts->iso_mbr_part_type >= 0 &&
+                t->opts->iso_mbr_part_type <= 255)
+                part_type= t->opts->iso_mbr_part_type;
+        }
 
         if (t->opts->appended_as_gpt && t->have_appended_partitions) {
             part_type = 0xee;
@@ -1985,9 +2026,13 @@
     } else if ((t->opts->partition_offset > 0 || will_append) &&
                sa_type == 0 && t->mbr_req_count == 0) {
         /* Write a simple partition table. */
+        part_type = 0xcd;
+        if (t->opts->iso_mbr_part_type >= 0 &&
+            t->opts->iso_mbr_part_type <= 255)
+            part_type= t->opts->iso_mbr_part_type;
         ret = make_grub_msdos_label(img_blocks, t->partition_secs_per_head,
                                     t->partition_heads_per_cyl,
-                                    (uint8_t) 0xcd, buf, 2);
+                                    (uint8_t) part_type, buf, 2);
         if (ret != ISO_SUCCESS) /* error should never happen */
             return ISO_ASSERT_FAILURE;
         risk_of_ee = 1;
@@ -2007,7 +2052,11 @@
         } else if (t->opts->partition_offset == 0) {
             /* Re-write partion entry 1 : start at 0, type Linux */
             blk = ((uint64_t) img_blocks) * 4 - t->post_iso_part_pad / 512;
-            ret = write_mbr_partition_entry(1, 0x83, (uint64_t) 0, blk,
+            part_type = 0x83;
+            if (t->opts->iso_mbr_part_type >= 0 &&
+                t->opts->iso_mbr_part_type <= 255)
+                part_type= t->opts->iso_mbr_part_type;
+            ret = write_mbr_partition_entry(1, part_type, (uint64_t) 0, blk,
                         t->partition_secs_per_head, t->partition_heads_per_cyl,
                         buf, 2);
             if (ret < 0)
@@ -2081,13 +2130,18 @@
     /* >>> ??? check for GPT magic number at byte 512 ff. ? */;
 
     if (sa_type == 0 && ((t->system_area_options & 3) || risk_of_ee) &&
-        (t->opts->part_like_isohybrid || t->gpt_req_count == 0)) {
+        (t->opts->part_like_isohybrid || t->gpt_req_count == 0) &&
+        t->opts->iso_mbr_part_type != 0xee) {
         for (i = 0; i < 4; i++) {
             if (buf[446 + 16 * i + 4] == 0xee) {
                 iso_msgs_submit(0,
                             "Prevented partition type 0xEE in MBR without GPT",
                             0, "WARNING", 0);
-                buf[446 + 16 * i + 4] = 0xcd;
+                part_type = 0xcd;
+                if (t->opts->iso_mbr_part_type >= 0 &&
+                    t->opts->iso_mbr_part_type <= 255)
+                    part_type= t->opts->iso_mbr_part_type;
+                buf[446 + 16 * i + 4] = (uint8_t) part_type;
             }
         }
     }
@@ -2095,7 +2149,7 @@
     if (sa_type == 0 && (
         (t->system_area_options & 3) ||
         (t->system_area_options & (1 << 14)) ||
-        (((t->system_area_options >> 2) & 0x3f) == 2 &&
+        (((t->system_area_options >> 10) & 15) != 1 &&
          (t->system_area_options & (1 << 15)))
         )) {
         /* This is an MBR which shall have a bootable/active flag
@@ -2106,7 +2160,7 @@
         break;
         if (i >= 4) { /* no bootable/active flag set yet */
             for (i = 0; i < 4; i++) {
-                if (buf[446 + 16 * i + 4] != 0x00 &&
+                if ((!mbr_part_slot_is_unused(buf + 446 + 16 * i)) &&
                     buf[446 + 16 * i + 4] != 0xee &&
                     buf[446 + 16 * i + 4] != 0xef) {
                     buf[446 + 16 * i] |= 0x80;
@@ -2120,6 +2174,14 @@
         }
     }
 
+    if ((((t->system_area_options >> 2) & 0x3f) == 0 &&
+         (t->system_area_options & 3) == 1) ||
+        t->opts->partition_offset > 0) {
+        /* Protective MBR || partition offset */
+        /* ISO will not be a partition. It can span the whole image. */
+        t->pvd_size_is_total_size = 1;
+    }
+
     return ISO_SUCCESS;
 }
 
@@ -2475,7 +2537,7 @@
        0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b
     };
     static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-    int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt;
+    int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt = 0;
     uint8_t gpt_name[72], *type_uuid;
 
 #ifndef Libisofs_appended_partitions_inlinE
@@ -2821,10 +2883,12 @@
 {
     Ecma119Image *t;
     IsoFileSrc *src;
-    int ret, will_have_gpt = 0, with_chrp = 0, i;
+    int ret, will_have_gpt = 0, with_chrp = 0, i, part_type, keep;
     static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
     static uint64_t gpt_flags = (((uint64_t) 1) << 60) | 1;
     uint8_t gpt_name[72];
+    uint64_t part_start;
+    off_t start_byte, byte_count;
 
     /* <<< ??? Move to system_area.h and publish as macro ? */
     static uint8_t efi_sys_uuid[16] = {
@@ -2842,6 +2906,7 @@
         will_have_gpt = 1;
 
     if (t->opts->efi_boot_partition != NULL) {
+        keep = 0;
         if (t->efi_boot_part_filesrc != NULL) {
             /* A file in the emerging ISO image shall store its content
                as prepended partition.
@@ -2853,23 +2918,35 @@
                 src->sections[i].block = t->curblock + t->efi_boot_part_size;
                 t->efi_boot_part_size += (src->sections[i].size + 2047) / 2048;
             }
+            part_start = t->curblock * 4;
         } else {
             ret = compute_partition_size(t, t->opts->efi_boot_partition,
                                          &(t->efi_boot_part_size),
                                          t->opts->efi_boot_part_flag & 1);
             if (ret < 0)
                 return ret;
+            part_start = t->curblock * 4;
+            if (ret == ISO_SUCCESS + 1) {
+                /* Interval from imported_iso in add-on session will be kept */
+                ret = iso_interval_reader_start_size(t,
+                                                  t->opts->efi_boot_partition,
+                                                  &start_byte, &byte_count, 0);
+                if (ret < 0)
+                    return ret;
+                part_start = start_byte / 512;
+                keep = 1;
+            }
         }
         memset(gpt_name, 0, 72);
         strcpy((char *) gpt_name, "EFI boot partition");
         iso_ascii_utf_16le(gpt_name);
-        ret = iso_quick_gpt_entry(t->gpt_req, &(t->gpt_req_count),
-                                 ((uint64_t) t->curblock) * 4,
+        ret = iso_quick_gpt_entry(t->gpt_req, &(t->gpt_req_count), part_start,
                                  ((uint64_t) t->efi_boot_part_size) * 4,
                                  efi_sys_uuid, zero_uuid, gpt_flags, gpt_name);
         if (ret < 0)
             return ret;
-        t->curblock += t->efi_boot_part_size;
+        if (!keep)
+            t->curblock += t->efi_boot_part_size;
     }
 
     if (with_chrp) {
@@ -2884,36 +2961,59 @@
         return ISO_SUCCESS;
     }
 
+    part_start = t->curblock * 4;
+    keep = 0;
     if (t->opts->prep_partition != NULL) {
         ret = compute_partition_size(t, t->opts->prep_partition,
                                      &(t->prep_part_size),
                                      t->opts->prep_part_flag & 1);
         if (ret < 0)
             return ret;
+        if (ret == ISO_SUCCESS + 1) {
+            /* Interval from imported_iso in add-on session will be kept */
+            ret = iso_interval_reader_start_size(t,
+                                                 t->opts->prep_partition,
+                                                 &start_byte, &byte_count, 0);
+            if (ret < 0)
+                return ret;
+            part_start = start_byte / 512;
+            keep = 1;
+        }
     }
     if (t->prep_part_size > 0 || t->opts->fat || will_have_gpt) {
         /* Protecting MBR entry for ISO start or whole ISO */
+        part_type = 0xcd;
+        if (t->opts->iso_mbr_part_type >= 0 &&
+            t->opts->iso_mbr_part_type <= 255)
+            part_type= t->opts->iso_mbr_part_type;
+        if (will_have_gpt)
+            part_type = 0xee;
         ret = iso_quick_mbr_entry(t->mbr_req, &(t->mbr_req_count),
                                   will_have_gpt ? (uint64_t) 1 :
                                   ((uint64_t) t->opts->partition_offset) * 4,
-                                  (uint64_t) 0,
-                                  will_have_gpt ? 0xee : 0xcd, 0, 0);
+                                  (uint64_t) 0, part_type, 0, 0);
         if (ret < 0)
             return ret;
     }
     if (t->prep_part_size > 0) {
-        ret = iso_quick_mbr_entry(t->mbr_req, &(t->mbr_req_count),
-                                  ((uint64_t) t->curblock) * 4,
+        ret = iso_quick_mbr_entry(t->mbr_req, &(t->mbr_req_count), part_start,
                                   ((uint64_t) t->prep_part_size) * 4,
                                   0x41, 0, 0);
         if (ret < 0)
             return ret;
-        t->curblock += t->prep_part_size;
+        if (!keep) {
+            t->curblock += t->prep_part_size;
+            part_start = t->curblock * 4;
+        } else {
+            part_start += t->prep_part_size * 4;
+        }
+    } else {
+        part_start = t->curblock * 4;
     }
     if (t->prep_part_size > 0 || t->opts->fat) {
         /* FAT partition or protecting MBR entry for ISO end */
         ret = iso_quick_mbr_entry(t->mbr_req, &(t->mbr_req_count),
-                                  ((uint64_t) t->curblock) * 4, (uint64_t) 0,
+                                  part_start, (uint64_t) 0,
                                   t->opts->fat ? 0x0c : 0xcd, 0, 0);
         if (ret < 0)
             return ret;


Reply via email to