DanaHan / Yolov5-in-Deepstream-5.0

Describe how to use yolov5 in Deepstream 5.0
209 stars 57 forks source link

Fix integer overflow when computing bounding box in NvDsInferParseYoloV4 and NvDsInferParseYoloV5 #38

Open mfoglio opened 11 months ago

mfoglio commented 11 months ago

Top and left values of a bounding box can sometimes be negative in degenerate cases. For instance, if an object is very close to the border of the image, top value could be -1. This would cause integer overflow due to assignment of negative values to unsigned int. The fix prevents the integer overflow in functions NvDsInferParseYoloV4 and NvDsInferParseYoloV5 by guaranteeing that top and left values are always nonnegative.