infinite recursion using counter.
* grub-core/lib/xzembed/xz_dec_stream.c (xz_dec_init): Defer s->crc32
init to skip it if the magic check fails.
(dec_stream_header): Init s->crc32.
+2012-01-23 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/normal/crypto.c (grub_crypto_autoload): Prevent
+ infinite recursion using counter.
+ * grub-core/lib/xzembed/xz_dec_stream.c (xz_dec_init): Defer s->crc32
+ init to skip it if the magic check fails.
+ (dec_stream_header): Init s->crc32.
+
2012-01-22 Vladimir Serbinenko <phcoder@gmail.com>
2012-01-22 Zachary Bedell <pendorbound@gmail.com>
2012-01-22 Richard Laager <rlaager@wiktel.com>
return XZ_FORMAT_ERROR;
#ifndef GRUB_EMBED_DECOMPRESSOR
+ s->crc32 = grub_crypto_lookup_md_by_name ("CRC32");
+
if (s->crc32)
{
uint64_t hash_context[(s->crc32->contextsize + 7) / 8];
memset (s, 0, sizeof (*s));
-#ifndef GRUB_EMBED_DECOMPRESSOR
- s->crc32 = grub_crypto_lookup_md_by_name ("CRC32");
-#endif
-
s->single_call = dict_max == 0;
#ifdef XZ_DEC_BCJ
{
struct load_spec *cur;
grub_dl_t mod;
-
+ static int depth = 0;
+
+ /* Some bufio of filesystems may want some crypto modules.
+ It may result in infinite recursion. Hence this check. */
+ if (depth)
+ return;
+ depth++;
+
for (cur = crypto_specs; cur; cur = cur->next)
if (grub_strcasecmp (name, cur->name) == 0)
{
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
}
+ depth--;
}
static void