|
From: | Lidong Chen |
Subject: | Re: [PATCH v2 0/5] fs/iso9660: Fix out-of-bounds read |
Date: | Fri, 20 Jan 2023 02:29:32 +0000 |
I ran grub-fastest with both ce_loop ISO files. The endless loops were detected
and Grub exited accordingly. I didn't know where the grub error message
were stored in case of grub-fastest. But, I traced with gdb, and saw the
code reported the error. If the diff looks good, I will send the v3 patches set.
+#define GRUB_ISO9660_MAX_CE_HOPS 100000
struct grub_iso9660_susp_entry *entry;
grub_err_t err;
+ int ce_counter = 0;
struct grub_iso9660_susp_ce *ce;
grub_disk_addr_t ce_block;
+
if (++ce_counter > GRUB_ISO9660_MAX_CE_HOPS)
+
{
+
grub_free (sua);
+
return grub_error (GRUB_ERR_BAD_FS,
+
"suspecting endless CE loop");
+
}
+
ce = (struct grub_iso9660_susp_ce *) entry;
entry = (struct grub_iso9660_susp_entry *) sua;
+
/*
+ * The hook function
will not process CE or ST.
+ * Advancing to
the next entry would skip them.
+
*/
+
if (grub_strncmp ((char *) entry->sig, "CE", 2) == 0
+
|| grub_strncmp ((char *) entry->sig, "ST", 2) == 0)
+
continue;
}
if (hook (entry, hook_arg))
Thanks,
Lidong
|
[Prev in Thread] | Current Thread | [Next in Thread] |