diff --git a/C/scanner.c b/C/scanner.c index a8b4c326b..9deddaf68 100644 --- a/C/scanner.c +++ b/C/scanner.c @@ -1003,7 +1003,11 @@ Yap_tokenizer(int inp_stream, Term *tposp) wcharp = NULL; while (TRUE) { - if (charp + 1024 > (char *)AuxSp) { + if (wcharp && wcharp + 1024 > (wchar_t *)AuxSp) { + Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR; + Yap_ErrorMessage = "Heap Overflow While Scanning: please increase code space (-h)"; + break; + } else if (charp + 1024 > (char *)AuxSp) { Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR; Yap_ErrorMessage = "Heap Overflow While Scanning: please increase code space (-h)"; break;