Make 'rb_get_args()' va_arg passing safer by introducing a termination marker
What can I say. I made a pact with the devil, and paid dearly. Almost a whole day's worth of debugging, actually. Not again. If this turns out to be slow we can always optimize the critical parts (with no variable param count) later, or completely remove it.
This commit is contained in:
		
							parent
							
								
									92525cd077
								
							
						
					
					
						commit
						4ff563725b
					
				
					 15 changed files with 92 additions and 48 deletions
				
			
		| 
						 | 
				
			
			@ -50,7 +50,7 @@ RB_METHOD(graphicsTransition)
 | 
			
		|||
	const char *filename = 0;
 | 
			
		||||
	int vague = 40;
 | 
			
		||||
 | 
			
		||||
	rb_get_args(argc, argv, "|izi", &duration, &filename, &vague);
 | 
			
		||||
	rb_get_args(argc, argv, "|izi", &duration, &filename, &vague, RB_ARG_END);
 | 
			
		||||
 | 
			
		||||
	GUARD_EXC( gState->graphics().transition(duration, filename, vague); )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ RB_METHOD(graphicsFrameReset)
 | 
			
		|||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		int value; \
 | 
			
		||||
		rb_get_args(argc, argv, "i", &value); \
 | 
			
		||||
		rb_get_args(argc, argv, "i", &value, RB_ARG_END); \
 | 
			
		||||
		gState->graphics().set##PropName(value); \
 | 
			
		||||
		return rb_fix_new(value); \
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ RB_METHOD(graphicsFrameReset)
 | 
			
		|||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		bool value; \
 | 
			
		||||
		rb_get_args(argc, argv, "b", &value); \
 | 
			
		||||
		rb_get_args(argc, argv, "b", &value, RB_ARG_END); \
 | 
			
		||||
		gState->graphics().set##PropName(value); \
 | 
			
		||||
		return rb_bool_new(value); \
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue