Restricted size of patchable boot images to 32 MB and prevented

stream filtering on such boot images.
This commit is contained in:
Thomas Schmitt 2015-08-11 12:02:26 +02:00
parent d3fefe4735
commit c8ed18695f
4 changed files with 23 additions and 4 deletions

View File

@ -1178,10 +1178,10 @@ int iso_patch_eltoritos(Ecma119Image *t)
continue;
original = t->bootsrc[idx]->stream;
size = (size_t) iso_stream_get_size(original);
/* >>> BOOT ts B00428 :
check whether size is not too large for buffering */;
if (size > Libisofs_elto_max_patchablE)
return ISO_PATCH_OVERSIZED_BOOT;
if (iso_stream_get_input_stream(original, 0) != NULL)
return ISO_PATCH_FILTERED_BOOT;
buf = calloc(1, size);
if (buf == NULL) {
return ISO_OUT_OF_MEM;

View File

@ -168,4 +168,11 @@ int iso_patch_eltoritos(Ecma119Image *t);
#define Libisofs_grub2_elto_patch_offsT 5
/* Maximum size of a boot image which is marked by
el_torito_set_isolinux_options() for patching (boot info table,
GRUB2 boot info, maybe others).
*/
#define Libisofs_elto_max_patchablE (32 * 1024 * 1024)
#endif /* LIBISO_ELTORITO_H */

View File

@ -8312,6 +8312,14 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
(NOTE, HIGH, -409) */
#define ISO_NOT_REPRODUCIBLE 0xB030FE67
/** May not write boot info into filtered stream of boot image
(FAILURE, HIGH, -410) */
#define ISO_PATCH_FILTERED_BOOT 0xE830FE66
/** Boot image to large to buffer for writing boot info
(FAILURE, HIGH, -411) */
#define ISO_PATCH_OVERSIZED_BOOT 0xE830FE65
/* Internal developer note:
Place new error codes directly above this comment.

View File

@ -531,6 +531,10 @@ const char *iso_error_to_msg(int errcode)
return "Unreadable file, premature EOF, or failure to seek for interval reader";
case ISO_NOT_REPRODUCIBLE:
return "Cannot arrange content of data files in surely reproducible way";
case ISO_PATCH_FILTERED_BOOT:
return "May not write boot info into filtered stream of boot image";
case ISO_PATCH_OVERSIZED_BOOT:
return "Boot image to large to buffer for writing boot info";
default:
return "Unknown error";
}