Skip to content

Conversation

maedoc
Copy link

@maedoc maedoc commented Jun 30, 2025

(hi! tahnks for the very nice project 🤗 )

el_gets on my macos sequoia 15.5 returns NULL when typing Ctrl-D to exit the reply. This is a tiny change to parse a NULL as if user entered quit.

For reference here is backtrace,

--- version 0.1.21
Manta IS NOT connected.
Type 'helpall' to get a list of all built-in functions.
Type 'quit' to quit.
sapf> ^D
💣 Program crashed: Bad pointer dereference at 0x0000000000000000

Thread 3 crashed:

 0 0x000000018b86b320 _platform_strncmp$VARIANT$Base + 176 in libsystem_platform.dylib
 1 Thread::compile(char const*, P<Fun>&, bool) + 432 in sapf at /Users/tng/src/sapf/src/VM.cpp:675:2

   673│         P<Code> code;
   674│         setParseString(inString);
   675│         getLine();                                                                                                                 
      │  ▲
   676│         bool ok = parseElems(th, code);
   677│         if (!ok || !code) {

 2 Thread::repl(__sFILE*, char const*) + 1000 in sapf at /Users/tng/src/sapf/src/VM.cpp:359:9

   357│                         {
   358│                                 P<Fun> compiledFun;
   359│                                 if (compile(NULL, compiledFun, true)) {                                                            
      │         ▲
   360│                                 // EVAL
   361│                                         compiledFun->runREPL(th);

 3 __main_block_invoke_2 + 68 in sapf at /Users/tng/src/sapf/src/main.cpp:201:6

   199│         
   200│         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
   201│                 th.repl(stdin, vm.log_file);                                                                                       
      │      ▲
   202│                 exit(0);
   203│         });

 4 0x000000018b676b2c _dispatch_call_block_and_release + 32 in libdispatch.dylib
 5 0x000000018b69085c _dispatch_client_callout + 16 in libdispatch.dylib
 6 0x000000018b6ac840 _dispatch_queue_override_invoke.cold.3 + 32 in libdispatch.dylib
 7 0x000000018b67b278 _dispatch_queue_override_invoke + 848 in libdispatch.dylib
 8 0x000000018b688e30 _dispatch_root_queue_drain + 364 in libdispatch.dylib
 9 0x000000018b6895d4 _dispatch_worker_thread2 + 156 in libdispatch.dylib
10 0x000000018b82ae28 _pthread_wqthread + 232 in libsystem_pthread.dylib

@maedoc maedoc changed the base branch from main to dev June 30, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant