mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* range.c (rb_range_beg_len): Fix potential bug for limit case [#6203]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									b317bf06a4
								
							
						
					
					
						commit
						165da0da2f
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		
							
								
								
									
										8
									
								
								range.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								range.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1076,16 +1076,16 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
 | 
			
		|||
	if (beg < 0)
 | 
			
		||||
	    goto out_of_range;
 | 
			
		||||
    }
 | 
			
		||||
    if (end < 0)
 | 
			
		||||
	end += len;
 | 
			
		||||
    if (!excl)
 | 
			
		||||
	end++;			/* include end point */
 | 
			
		||||
    if (err == 0 || err == 2) {
 | 
			
		||||
	if (beg > len)
 | 
			
		||||
	    goto out_of_range;
 | 
			
		||||
	if (end > len)
 | 
			
		||||
	    end = len;
 | 
			
		||||
    }
 | 
			
		||||
    if (end < 0)
 | 
			
		||||
	end += len;
 | 
			
		||||
    if (!excl)
 | 
			
		||||
	end++;			/* include end point */
 | 
			
		||||
    len = end - beg;
 | 
			
		||||
    if (len < 0)
 | 
			
		||||
	len = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue