diff options
author | Anastasia Belova <[email protected]> | 2025-01-28 15:08:54 +0300 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-01-29 10:35:28 +0900 |
commit | ff64806ae51c2813f0c6334c0c52082b027c255c () | |
tree | c35fb32b44ef96228a642a6067d0d04174776012 /node.h | |
parent | a34b95fef973baa718b8c56324d45e5080ac0030 (diff) |
Fix possible dereference of NULL
In some places in compile.c (for example in compile_builtin_arg) ERROR_ARGS macro is used while node = NULL. This macro uses nd_line which dereferences node. Add check for NULL to prevent such errors.
Notes: Merged: https://.com/ruby/ruby/pull/12656
-rw-r--r-- | node.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -74,7 +74,7 @@ RUBY_SYMBOL_EXPORT_END #define NODE_LSHIFT (NODE_TYPESHIFT+7) #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1) -#define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT) #define nd_set_line(n,l) \ (n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT)) |