Skip to content

More segmentation faults #87

@robotii

Description

@robotii

The following lines each result in a segfault

Function()()

This can be fixed by a check in potion_call that the closure and closure->method is not null and returning PN_NIL if either are null. You might also want to output a warning that the method was null.

Error()

This is caused by the REPL trying to print the error object by converting to string, where the message is set to null. The offending call to potion_str_ptr being in potion_error_string.

Compiled()

Again this is caused by the REPL trying to print out the value. The problem occurs in potion_proto_string about 9 lines in, on the pn_printf statement.

The last two errors only occur in the REPL, and don't cause a problem unless they are called or converted to string, when the lack of data in the structs becomes a problem.

Possibly for Error, it would be nice to have a constructor that took a string and returned a valid Error object, but I can't see any reason why the Compiled constructor should be exposed at all.

Lobby cmp 0

This is caused by an infinite loop in potion_any_cmp, where there should probably be a check for lobby and if so, directly return a value.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions