diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-08-30 11:09:49 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-08-30 11:09:49 -0500 |
| commit | 455226ffded69538f5f453b566b499361b201ffb (patch) | |
| tree | a64be3c50e3ce39d835474154688c35e9dd09913 /shared-bindings | |
| parent | 0adccc50dcc9e9db9a054da563fe4f165e8d912e (diff) | |
builtinimport: Fix a crash with 'import ulab.linalg' on unix port only
A crash like the following occurs in the unix port:
```
Program received signal SIGSEGV, Segmentation fault.
0x00005555555a2d7a in mp_obj_module_set_globals (self_in=0x55555562c860 <ulab_user_cmodule>, globals=0x55555562c840 <mp_module_ulab_globals>) at ../../py/objmodule.c:145
145 self->globals = globals;
(gdb) up
#1 0x00005555555b2781 in mp_builtin___import__ (n_args=5, args=0x7fffffffdbb0) at ../../py/builtinimport.c:496
496 mp_obj_module_set_globals(outer_module_obj,
(gdb)
#2 0x00005555555940c9 in mp_import_name (name=824, fromlist=0x555555621f10 <mp_const_none_obj>, level=0x1) at ../../py/runtime.c:1392
1392 return mp_builtin___import__(5, args);
```
I don't understand how it doesn't happen on the embedded ports, because
the module object should reside in ROM and the assignment of self->globals
should trigger a Hard Fault.
By checking VERIFY_PTR, we know that the pointed-to data is on the heap
so we can do things like mutate it.
Diffstat (limited to 'shared-bindings')
0 files changed, 0 insertions, 0 deletions
