mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Fix _PyTime_AsTimevalStruct_impl() on OpenBSD
On the x86 OpenBSD 5.8 buildbot, the integer overflow check is ignored. Copy the tv_sec variable into a Py_time_t variable instead of "simply" casting it to Py_time_t, to fix the integer overflow check.
This commit is contained in:
		
							parent
							
								
									0d30940dd2
								
							
						
					
					
						commit
						b7a8af20ff
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -454,7 +454,7 @@ static int | |||
| _PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv, | ||||
|                              _PyTime_round_t round, int raise) | ||||
| { | ||||
|     _PyTime_t secs; | ||||
|     _PyTime_t secs, secs2; | ||||
|     int us; | ||||
|     int res; | ||||
| 
 | ||||
|  | @ -467,7 +467,8 @@ _PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv, | |||
| #endif | ||||
|     tv->tv_usec = us; | ||||
| 
 | ||||
|     if (res < 0 || (_PyTime_t)tv->tv_sec != secs) { | ||||
|     secs2 = (_PyTime_t)tv->tv_sec; | ||||
|     if (res < 0 || secs2 != secs) { | ||||
|         if (raise) | ||||
|             error_time_t_overflow(); | ||||
|         return -1; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner