mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	Address #795 - add NULL check to avoid UB
This commit is contained in:
		| @@ -37,8 +37,9 @@ static void push_traversal_node(void *lhs, void *rhs, int32_t index2) { | |||||||
|     node.other = (JanetGCObject *) rhs; |     node.other = (JanetGCObject *) rhs; | ||||||
|     node.index = 0; |     node.index = 0; | ||||||
|     node.index2 = index2; |     node.index2 = index2; | ||||||
|     if (janet_vm.traversal + 1 >= janet_vm.traversal_top) { |     int is_new = janet_vm.traversal_base == NULL; | ||||||
|         size_t oldsize = janet_vm.traversal - janet_vm.traversal_base; |     if (is_new || (janet_vm.traversal + 1 >= janet_vm.traversal_top)) { | ||||||
|  |         size_t oldsize = is_new ? 0 : (janet_vm.traversal - janet_vm.traversal_base); | ||||||
|         size_t newsize = 2 * oldsize + 1; |         size_t newsize = 2 * oldsize + 1; | ||||||
|         if (newsize < 128) { |         if (newsize < 128) { | ||||||
|             newsize = 128; |             newsize = 128; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 bakpakin
					bakpakin