]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Merge remote-tracking branch 'remotes/alistair/tags/pull-device-tree-20190409-1'...
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 10 Apr 2019 07:57:19 +0000 (08:57 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 10 Apr 2019 07:57:19 +0000 (08:57 +0100)
Single device tree fix for 4.0

A single patch to avoid an overflow when loading device trees.

# gpg: Signature made Wed 10 Apr 2019 00:52:16 BST
# gpg:                using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [full]
# Primary key fingerprint: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* remotes/alistair/tags/pull-device-tree-20190409-1:
  device_tree: Fix integer overflowing in load_device_tree()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
device_tree.c

index 296278e12ae01020e7c0b8564587a7fa4d2dcf16..f8b46b3c7331ae42dcc3be5ee4c5ce3d370d47c6 100644 (file)
@@ -84,6 +84,10 @@ void *load_device_tree(const char *filename_path, int *sizep)
                      filename_path);
         goto fail;
     }
+    if (dt_size > INT_MAX / 2 - 10000) {
+        error_report("Device tree file '%s' is too large", filename_path);
+        goto fail;
+    }
 
     /* Expand to 2x size to give enough room for manipulation.  */
     dt_size += 10000;