[vlc-devel] [PATCH 1/5] omxil: Only print psz_role if OMX_ComponentRoleEnum succeeded

Martin Storsjö martin at martin.st
Wed Sep 21 10:19:04 CEST 2011


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.
---
 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 */
-- 
1.7.2.5




More information about the vlc-devel mailing list