[vlc-commits] omxil: Only print psz_role if OMX_ComponentRoleEnum succeeded

Martin Storsjö git at videolan.org
Wed Sep 21 12:36:06 CEST 2011


vlc | branch: master | Martin Storsjö <martin at martin.st> | Wed Sep 21 11:19:04 2011 +0300| [d4f0c5f192495471d244e93f48f54b421cbc815e] | committer: Jean-Baptiste Kempf

omxil: Only print psz_role if OMX_ComponentRoleEnum succeeded

Earlier, an uninitialized string would be printed if
OMX_ComponentRoleEnum failed (or if it was unimplemented, see
omxil_utils.h), potentially leading to out of bounds reads.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/omxil/omxil.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 9b7de2b..0e0b13e 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -577,8 +577,11 @@ static OMX_ERRORTYPE InitialiseComponent(decoder_t *p_dec,
     }
     strncpy(p_sys->psz_component, psz_component, OMX_MAX_STRINGNAME_SIZE-1);
 
-    OMX_ComponentRoleEnum(omx_handle, psz_role, 0);
-    msg_Dbg(p_dec, "loaded component %s of role %s", psz_component, psz_role);
+    omx_error = OMX_ComponentRoleEnum(omx_handle, psz_role, 0);
+    if(omx_error == OMX_ErrorNone)
+        msg_Dbg(p_dec, "loaded component %s of role %s", psz_component, psz_role);
+    else
+        msg_Dbg(p_dec, "loaded component %s", psz_component);
     PrintOmx(p_dec, omx_handle, OMX_ALL);
 
     /* Set component role */



More information about the vlc-commits mailing list