[libbluray-devel] Avoid calloc(0)

hpi1 git at videolan.org
Mon Jun 26 15:23:51 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Jun 26 14:27:52 2017 +0300| [f80f4d2f0a061854dc63f67fe6c6f8fc553a7c53] | committer: hpi1

Avoid calloc(0)

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=f80f4d2f0a061854dc63f67fe6c6f8fc553a7c53
---

 src/libbluray/hdmv/mobj_parse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libbluray/hdmv/mobj_parse.c b/src/libbluray/hdmv/mobj_parse.c
index a4c2516e..cb5abd7d 100644
--- a/src/libbluray/hdmv/mobj_parse.c
+++ b/src/libbluray/hdmv/mobj_parse.c
@@ -98,6 +98,10 @@ static int _mobj_parse_object(BITSTREAM *bs, MOBJ_OBJECT *obj)
     bs_skip(bs, 13); /* padding */
 
     obj->num_cmds = bs_read(bs, 16);
+    if (!obj->num_cmds) {
+        BD_DEBUG(DBG_HDMV|DBG_CRIT, "MovieObject.bdmv: empty object\n");
+        return 1;
+    }
     obj->cmds     = calloc(obj->num_cmds, sizeof(MOBJ_CMD));
     if (!obj->cmds) {
         BD_DEBUG(DBG_CRIT, "out of memory\n");



More information about the libbluray-devel mailing list