zserge / partcl

ParTcl - a micro Tcl implementation
https://zserge.com/posts/tcl-interpreter/
MIT License
470 stars 50 forks source link

Issues I found during fuzzing #7

Open shrezaei opened 5 years ago

shrezaei commented 5 years ago

I ran AFL fuzzer on your program and found pleny of crashes. But, mostly that happened because of passing NULL pointer to function such as strcmp. Most of the crashes happened at line 272 when strcmp is called. I fixed the problem by checking whether passing arguments to the tcl_var() are empty or not. For example, in tcl_cmd_set() function, you called tcl_var(). You can simply solve the problem by checking if var pointer is empty or not and then return FERROR if it is empty.