-
Notifications
You must be signed in to change notification settings - Fork 41
Description
-
get/set_proto_data
- uses byte-offsets and has no range checking. Suggestion:- Don't accept offset < 0.
- Check proto type/subtype and don't accept offsets above the upper bounds.
-
get/set_object_data
- uses byte offsets and direct memory pointer for object, is not limited an any way. Available with UnsafeScripting disabled, but actually works exactly the same asread_xxx
,write_xxx
opcodes if you just pass 0 as object pointer...- Disable this function if
UnsafeScripting
is disabled, because it's impossible to know what type of object is being pointed to for proper offset range validation. - Mark as deprecated and remove from sfall.h. Who wants unsafe scripts should use normal unsafe scripting functions (just add object pointer and offsets together, duh).
- Possibly add object-specific metarules with enum-based fields, just like
get_ai_object_data
orset_drugs_data
.
- Disable this function if
This will break a few mods, but it is worth it, IMO:
- Unsafe functions like these won't work when porting to Fallout CE or similar, unless they never actually go out of object bounds and the other engine has perfect struct binary compatibility with original game.
- Just why have UnsafeScripting option in the first place if it doesn't actually disable unsafe scripting?
Of course if we want to somehow "protect" from malicious scripting, a lot of other things need to be considered (and not sure if it's really possible, given the game's engine is full of holes as it is). But I think we should at least discourage mod creators from using these not because of malicious intent, but simple errors in scripts that could lead to hard-to-debug crashes due to memory overwrites and reads at incorrect offsets.