minigbm: add some validation check in cros_gralloc

1. Check if the buffer handle
   - Validate if the handle is null or not
   - Check the size of the handle to make sure it will not cause oob read/write
2. Check num_planes to make sure it matches with numFds
3. Created b/291606090 for the follow up about updating cros_gralloc_driver level api to take cros_gralloc_handle_t

BUG=b:289303132
TEST=patch the change on rvc-arc and tested with ARCVM

Change-Id: Id03ec45f928fe6db62bb1722ee0dbc6c8831fd46
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4674736
Reviewed-by: Yiwei Zhang <[email protected]>
Commit-Queue: Dawn Han <[email protected]>
Tested-by: Dawn Han <[email protected]>
2 files changed