Mesa (master): radeon: return EINVAL for 0 length buffers.

Alex Deucher agd5f at kemper.freedesktop.org
Mon Oct 19 16:12:30 UTC 2009


Module: Mesa
Branch: master
Commit: e5d6450c2c85cc7d645cb0736194f41e5393802d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5d6450c2c85cc7d645cb0736194f41e5393802d

Author: Robert Noland <rnoland at 2hip.net>
Date:   Wed Oct 14 13:58:56 2009 -0500

radeon: return EINVAL for 0 length buffers.

Signed-off-by: Robert Noland <rnoland at 2hip.net>

---

 src/mesa/drivers/dri/radeon/radeon_bo_legacy.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index 3e7547d..ce60a2f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -710,6 +710,10 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
                 bo, bo->size, bo_legacy->map_count);
         return -EINVAL;
     }
+    if(bo->size == 0) {
+        fprintf(stderr, "bo(%p) has size 0.\n", bo);
+        return -EINVAL;
+    }
     if (bo_legacy->static_bo || bo_legacy->validated) {
         *soffset = bo_legacy->offset;
         *eoffset = bo_legacy->offset + bo->size;




More information about the mesa-commit mailing list