Headline
CVE-2022-36001: Fix dtype bug in draw bounding boxes. · tensorflow/tensorflow@da0d65c
TensorFlow is an open source platform for machine learning. When DrawBoundingBoxes
receives an input boxes
that is not of dtype float
, it gives a CHECK
fail that can trigger a denial of service attack. We have patched the issue in GitHub commit da0d65cdc1270038e72157ba35bf74b85d9bda11. The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. There are no known workarounds for this issue.
@@ -50,11 +50,16 @@ def _fillBorder(self, image, color): image[height - 1, 0:width, 0:depth] = color return image
def _testDrawBoundingBoxColorCycling(self, img, colors=None): def _testDrawBoundingBoxColorCycling(self, img, dtype=dtypes.float32, colors=None): """Tests if cycling works appropriately. Args: img: 3-D numpy image on which to draw. dtype: image dtype (float, half). colors: color table. “"” color_table = colors if colors is None: @@ -82,7 +87,7 @@ def _testDrawBoundingBoxColorCycling(self, img, colors=None): bboxes = math_ops.cast(bboxes, dtypes.float32) bboxes = array_ops.expand_dims(bboxes, 0) image = ops.convert_to_tensor(image) image = image_ops_impl.convert_image_dtype(image, dtypes.float32) image = image_ops_impl.convert_image_dtype(image, dtype) image = array_ops.expand_dims(image, 0) image = image_ops.draw_bounding_boxes(image, bboxes, colors=colors) with self.cached_session(use_gpu=False) as sess: @@ -118,6 +123,14 @@ def testDrawBoundingBoxRGBAColorCyclingWithColors(self): [0, 0, 0.5, 1]]) self._testDrawBoundingBoxColorCycling(image, colors=colors)
def testDrawBoundingBoxHalf(self): “""Test if RGBA color cycling works correctly with provided colors.""” image = np.zeros([10, 10, 4], “float32”) colors = np.asarray([[0.5, 0, 0.5, 1], [0.5, 0.5, 0, 1], [0.5, 0, 0, 1], [0, 0, 0.5, 1]]) self._testDrawBoundingBoxColorCycling( image, dtype=dtypes.half, colors=colors)
if __name__ == "__main__": test.main()
Related news
### Impact When `DrawBoundingBoxes` receives an input `boxes` that is not of dtype `float`, it gives a `CHECK` fail that can trigger a denial of service attack. ```python import tensorflow as tf import numpy as np arg_0=tf.constant(value=np.random.random(size=(1, 3, 2, 3)), shape=(1, 3, 2, 3), dtype=tf.half) arg_1=tf.constant(value=np.random.random(size=(1, 2, 4)), shape=(1, 2, 4), dtype=tf.float32) arg_2='' tf.raw_ops.DrawBoundingBoxes(images=arg_0, boxes=arg_1, name=arg_2) ``` ### Patches We have patched the issue in GitHub commit [da0d65cdc1270038e72157ba35bf74b85d9bda11](https://github.com/tensorflow/tensorflow/commit/da0d65cdc1270038e72157ba35bf74b85d9bda11). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. ### For more information Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY...