From ece8c2002e7c81e8bbd8aba83c155959aaa5ef21 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 11 Feb 2019 20:34:17 -0500 Subject: [PATCH] change alloca to static buffer to avoid spurious exception handling error --- jpeg.d | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jpeg.d b/jpeg.d index f1c51c7..f2a5e8b 100644 --- a/jpeg.d +++ b/jpeg.d @@ -2971,9 +2971,10 @@ public bool detect_jpeg_image_from_file (const(char)[] filename, out int width, bool m_eof_flag, m_error_flag; if (filename.length == 0) throw new Exception("cannot open unnamed file"); - if (filename.length < 2048) { - import core.stdc.stdlib : alloca; - auto tfn = (cast(char*)alloca(filename.length+1))[0..filename.length+1]; + if (filename.length < 512) { + char[513] buffer; + //import core.stdc.stdlib : alloca; + auto tfn = buffer[0 .. filename.length + 1]; // (cast(char*)alloca(filename.length+1))[0..filename.length+1]; tfn[0..filename.length] = filename[]; tfn[filename.length] = 0; m_pFile = fopen(tfn.ptr, "rb");