Fix range check bug in FileList::seek() (#13286)
When `count()` returns 0, `pos > (count()-1)` will always yield `true` due to integer underflow.
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							05c2f80826
						
					
				
				
					commit
					57afd0ab37
				
			@@ -688,7 +688,7 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  bool FileList::seek(const uint16_t pos, const bool skip_range_check) {
 | 
			
		||||
    #if ENABLED(SDSUPPORT)
 | 
			
		||||
      if (!skip_range_check && pos > (count() - 1)) return false;
 | 
			
		||||
      if (!skip_range_check && (pos + 1) > count()) return false;
 | 
			
		||||
      const uint16_t nr =
 | 
			
		||||
        #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
 | 
			
		||||
          count() - 1 -
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user