Every line of 'index out of range' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
189 func isInBounds(data []byte, i int) bool { 190 return i >= 0 && i < len(data) 191 }
161 func (heap *Heap) withinRange(index int) bool { 162 return index >= 0 && index < heap.list.Size() 163 }
98 func checkIndex(min, max, i int) error { 99 if i < min { 100 return NewErrBadIndex("%v, min=%v", i, min) 101 } 102 if i > max { // allow max 103 return NewErrBadIndex("%v, max=%v", i, max) 104 } 105 return nil 106 }
293 func (sc *SliceColumn) inBounds(i int) error { 294 if i >= 0 && i < sc.Len() { 295 return nil 296 } 297 298 return fmt.Errorf("index %d out of bounds [0:%d]", i, sc.Len()) 299 }
253 func (Bool) IndexSet(index, value Object) error { 254 return ErrNotIndexAssignable 255 }
269 func (matrix *DenseFloat64Matrix) IntAt(i, j int) int { 270 return int(matrix.values[matrix.index(i, j)]) 271 }
77 func (pstruct *Struct) SetIndex(index, value interface{}) int { 78 sindex := int(index.(int64)) 79 if sindex < 0 || sindex >= len(pstruct.Values) { 80 return core.ErrIndexOut 81 } 82 pstruct.Values[sindex] = value 83 return 0 84 }
88 func (i *Int) InRange(lowerLimit int, upperLimit int) structure.Int { 89 if i.value != nil { 90 if *i.value < lowerLimit || *i.value > upperLimit { 91 i.base.ReportError(ErrorValueNotInRange(*i.value, lowerLimit, upperLimit)) 92 } 93 } 94 return i 95 }
213 func (me *Int3x3) AccessIndex(i, j int) interface{} { 214 if j >= 0 { 215 i = index2D(i, j, len(me)) 216 } 217 return &me[i] 218 }
157 func (s *Base) InRange(index int) bool { 158 return index >= 0 && index < s.Len() 159 }