diff options
author | Samuel Williams <[email protected]> | 2023-08-29 20:04:14 +1200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-08-29 20:04:14 +1200 |
commit | 901b6d9c5025a30b3d7a5ed0a2c00baf9cfb061d (patch) | |
tree | a7331e00fb79b82e8ecf59bad22c43409e21d704 /process.c | |
parent | 141102b0b08c4feb682210033cac8d0f042c4beb (diff) |
Validate the typed data before dereferencing the internal struct. (#8315)
Notes
Notes:
Merged-By: ioquatix <[email protected]>
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1222,7 +1222,7 @@ rb_waitpid(rb_pid_t pid, int *st, int flags) VALUE status = rb_process_status_wait(pid, flags); if (NIL_P(status)) return 0; - struct rb_process_status *data = RTYPEDDATA_DATA(status); + struct rb_process_status *data = rb_check_typeddata(status, &rb_process_status_type); pid = data->pid; if (st) *st = data->status; @@ -4748,7 +4748,8 @@ rb_f_system(int argc, VALUE *argv, VALUE _) if (pid > 0) { VALUE status = rb_process_status_wait(pid, 0); - struct rb_process_status *data = RTYPEDDATA_DATA(status); + + struct rb_process_status *data = rb_check_typeddata(status, &rb_process_status_type); // Set the last status: rb_obj_freeze(status); |