openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

h264 encode crash

Open volvet opened this issue 12 years ago • 9 comments

on MAC book step 1. git clone https://github.com/cisco/openh264 step 2. make step 3. cd testbin gdb ../h264enc run welsenc.cfg

then crash.
the crash stack: gdb) bt #0 0x00007fff88cbfb3b in std::string::assign () #1 0x0000000100002161 in ParseConfig () #2 0x00000001000043ac in ProcessEncodingSvcWithConfig () #3 0x0000000100004a2f in main ()

could someone take a look?

volvet avatar Mar 12 '14 03:03 volvet

it seems related to reading input config file in welsenc.cpp at: if (strTag[1].length() > 0) sFileSet.strSeqFile = strTag[1];

sijchen avatar Mar 12 '14 03:03 sijchen

I was unable to repro this so far on my MacPro OSX 10.9.

ethanhugg avatar Mar 12 '14 03:03 ethanhugg

no crash on IMac OSX 10.9

huili2 avatar Mar 12 '14 06:03 huili2

I have tested at 4 MAC, one is 10.7.5, crash, two is 10.8.5, crash, one 10.9, work well.

volvet avatar Mar 12 '14 06:03 volvet

I also test on Ubuntu 10.04 LTS, it also will crash.

volvet avatar Mar 12 '14 06:03 volvet

I think I have found one root cause.

welsenc.cpp @ line 852: memset (&fs,0,sizeof(SFilesSet));

the fs is struct but it contain some stl string object. the memset will cause the object corrupt. then it cause crash later when use the ojbects.

after fix it, the MAC book can work well, but still crash at Ubuntu. I will raise a fix first, then to debug on Linux.

volvet avatar Mar 12 '14 07:03 volvet

I found another root cause. If a CReadConfig object is copied, the m_cfgFile maybe be closed multiple times. This will cause glibc double free. The solution is here: change the prototype of ParseLayerConfig to int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam ) After this change, the encoder will not crash on Ubuntu 64

licaiguo avatar Mar 12 '14 08:03 licaiguo

licaiguo, Yes. you are right!!! why pass the object by the copy construct here?
I will raise a fix at once.

volvet avatar Mar 12 '14 08:03 volvet

after the two merges, encoder can work well at my side, so I close the issue now.

volvet avatar Mar 12 '14 08:03 volvet