+2011-12-15 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/lib/reed_solomon.c (decode_block): Allocate on heap and not
+ stack.
+ (encode_block): Likewise.
+
2011-12-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/boot/i386/pc/startup_raw.S: Clear direction flag for
{
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
- gf_single_t m[ds + rr];
+ gf_single_t *m;
/* Nothing to do. */
if (!ds || !rr)
continue;
+#ifndef STANDALONE
+ m = xmalloc (ds + rr);
+#else
+ m = (gf_single_t *) scratch;
+ scratch += ds + rr;
+#endif
+
for (j = 0; j < (int) ds; j++)
m[j] = ptr[SECTOR_SIZE * j + i];
for (j = 0; j < (int) rr; j++)
for (j = 0; j < (int) ds; j++)
ptr[SECTOR_SIZE * j + i] = m[j];
+
+#ifndef STANDALONE
+ free (m);
+#else
+ scratch -= ds + rr;
+#endif
}
}
{
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
- gf_single_t m[ds + rr];
+ gf_single_t *m;
+
+ if (!ds || !rr)
+ continue;
+
+ m = xmalloc (ds + rr);
for (j = 0; j < ds; j++)
m[j] = ptr[SECTOR_SIZE * j + i];
rs_encode (m, ds, rr);
for (j = 0; j < rr; j++)
rptr[SECTOR_SIZE * j + i] = m[j + ds];
+ free (m);
}
}
#endif