Re: [Ekiga-devel-list] Ekiga 3.3.0 crash on h263 and h263-1998



I am not sure it is related to the bug you mentioned Eugen. It depends
on Opal for sure. The context is not being initialised. It might depend
on ffmpeg if, for example, avcodec_alloc_context() has failed, but I had
no time to check it further.

In any case, I have managed to create a temporary fix, which works for
me:

http://sourceforge.net/tracker/?
func=detail&aid=3163160&group_id=204472&atid=989748

diff -pruN opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx opal-3.8.3-fix-
h263-crash-on-null-context//plugins/video/H.263-1998/h263-1998.cxx
--- opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx   2010-12-20 23:42:
42.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.263-1998/h263-
1998.cxx   2011-01-21 06:26:16.283344061 +0100
@@ -221,7 +221,7 @@ H263_Base_EncoderContext::H263_Base_Enco
 
 H263_Base_EncoderContext::~H263_Base_EncoderContext()
 {
-  free(_inputFrameBuffer);
+  if (_inputFrameBuffer) free(_inputFrameBuffer);
 }
 
 bool H263_Base_EncoderContext::Open(CodecID codecId)
@@ -517,8 +517,8 @@ H263_RFC2190_EncoderContext::~H263_RFC21
 
   CloseCodec();
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -770,8 +770,8 @@ H263_RFC2429_EncoderContext::~H263_RFC24
   if (_txH263PFrame)
     delete _txH263PFrame;
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -951,8 +951,8 @@ H263_Base_DecoderContext::~H263_Base_Dec
 {
   CloseCodec();
 
-  av_free(_context);
-  av_free(_outputFrame);
+  if (_context) av_free(_context);
+  if (_outputFrame) av_free(_outputFrame);
 }
 
 bool H263_Base_DecoderContext::OpenCodec()
@@ -1315,7 +1315,7 @@ static int free_codec_options ( const st
   char ** strings = (char **) parm;
   for (char ** string = strings; *string != NULL; string++)
     free(*string);
-  free(strings);
+  if (strings) free(strings);
   return 1;
 }
 
@@ -1360,7 +1360,12 @@ static int codec_encoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, 
*toLen, *flag);
+  if (context)
+       return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, 
*toLen, *flag);
+  else {
+       TRACE_AND_LOG(tracer, 1, "Context for the encoder has not been 
initialised !");
+       return 0;
+  }
 }
 
 #define PMAX(a,b) ((a)>=(b)?(a):(b))
@@ -1590,7 +1595,7 @@ static int encoder_set_options(const Plu
                                unsigned * parmLen)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL)
+  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL || 
context == NULL)
     return 0;
 
   context->Lock();
@@ -1678,7 +1683,12 @@ static int codec_decoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_DecoderContext * context = (H263_Base_DecoderContext *)_context;
-  return context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, 
*toLen, *flag) ? 1 : 0;
+  if (context)
+       context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, 
*toLen, *flag) ? 1 : 0;
+  else {
+        TRACE_AND_LOG(tracer, 1, "Context for the decoder has not been 
initialised !");
+        return 0;
+  }
 }
 
 static int decoder_get_output_data_size(const PluginCodec_Definition * codec, 
void *, const char *, void *, unsigned *)
diff -pruN opal-3.8.3/plugins/video/H.264/h264-x264.h opal-3.8.3-fix-h263-
crash-on-null-context//plugins/video/H.264/h264-x264.h
--- opal-3.8.3/plugins/video/H.264/h264-x264.h  2010-12-20 23:42:42.000000000 
+0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.264/h264-x264.
h  2011-01-21 06:11:44.545191085 +0100
@@ -54,7 +54,10 @@
 
 #include "shared/h264frame.h"
 
-
+#ifndef INT64_C
+#define INT64_C(c) (c ## LL)
+#define UINT64_C(c) (c ## ULL)
+#endif
 
 extern "C" {
 #ifdef _MSC_VER
diff -pruN opal-3.8.3/src/codec/opalpluginmgr.cxx opal-3.8.3-fix-h263-crash-on-
null-context//src/codec/opalpluginmgr.cxx
--- opal-3.8.3/src/codec/opalpluginmgr.cxx      2010-12-20 23:43:00.000000000 
+0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//src/codec/opalpluginmgr.
cxx      2011-01-21 05:57:51.479056064 +0100
@@ -302,7 +302,7 @@ void OpalPluginMediaFormatInternal::SetO
         format.AddOption(new OpalMediaOptionString(key, false, val), true);
         break;
     }
-    free(array);
+    if (array) free(array);
   }
 }
 
@@ -488,7 +488,7 @@ bool OpalPluginMediaFormatInternal::Adju
     freeOptionsControl.Call(output, sizeof(output));
   }
 
-  free(input);
+  if (input) free(input);
 
   return ok;
 }
@@ -654,7 +654,7 @@ bool OpalPluginTranscoder::UpdateOptions
 
   char ** options = fmt.GetOptions().ToCharArray(false);
   bool ok = setCodecOptions.Call(options, sizeof(options), context) != 0;
-  free(options);
+  if (options) free(options);
   return ok;
 }
 

Regards,

Guido

On Thu, 20/01/2011 at 09.04 +0100, Eugen Dedu wrote:
> On 20/01/11 05:42, g trentalancia libero it wrote:
> > Ekiga version 3.3.0
> > Opal version 3.8.3
> > Ptlib version 2.8.3
> >
> > ffmpeg-0.6.1
> >
> > This crash is very easy to reproduce and happens always. Just call any 
number
> > using any
> > audio codec and the H263 or H263-1998 video codec. Ekiga crashes
> > immediately after the call begins.
> >
> > This does not occur when no video codec is selected or any of the other
> > video codecs is used (theora, h261, mp4v-es).
> >
> > Attached stack backtrace.
> 
> Thank you for the stack.  This is a known issue, see 
> https://bugzilla.gnome.org/show_bug.cgi?id=606265 and help if you can.
> 

Attachment: opal-3.8.3-fix-h263-crash-on-null-context.patch
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]