Segmentation fault with decoder

Hi,

We use the decoder of tegra_multimedia_api on r28.2.1, we encounter segmentation fault.

I run the 00_video_decode to reproduce this issue.

./video_decode H264 --input-nalu --disable-rendering nosps.264

The nosps.264 file is in the attachment, and it is losted the SPS header.
http://120.77.3.207/nosps.264

./video_decode H264 --input-nalu --disable-rendering nosps.264
Set governor to performance before enabling profiler
run cnt 0
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 261
TVMR: NvMMLiteTVMRDecBlockOpen: 7647: NvMMLiteBlockOpen
NvMMLiteBlockCreate : Block : BlockType = 261
Starting decoder capture loop thread

Could not read nal unit from file. EOF or file corrupted
Input file read complete
TVMR: NvMMLiteTVMRDecDoWork: 6531: NVMMLITE_TVMR: EOS detected
TVMR: TVMRBufferProcessing: 5486: Processing of EOS
TVMR: TVMRBufferProcessing: 5563: Processing of EOS Done
Segmentation fault (core dumped)

Thanks!

Hi,

I had tested on r32.1, but it still segmentation fault.

Any advises? Thanks!

@zcs
We will check on r32.1/TX2 and update.

Hi,
You can avoid it by adding bitstream check in application. Please refer to patch attached.

r28_2_1_inspect_sps_pps_1.zip (3 KB)

Hi, DaneLLL

Thank you for your reply.

The “nosps.264” file was manually generated, just wanted to reproduce this issue. In practice, we can not check whether there are errors in the bitstream in the application.

Like the following file, it still cause an exception from the decoder after patch it.
http://120.77.3.207/err.264

We debug it by gdb and find that is a bug in “libnvmm_utils.so”. Could you fix it?

Thread 10 “video_decode” received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fac8901d0 (LWP 17272)]
0x0000007fb3c2eb28 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
(gdb) bt
#0 0x0000007fb3c2eb28 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
#1 0x0000007fb3c9c5dc in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#2 0x0000007fb7651628 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvos.so
#3 0x0000007fb7f8a088 in start_thread (arg=0x7fffffe55f) at pthread_create.c:463
#4 0x0000007fb7ae54ec in thread_start () at …/sysdeps/unix/sysv/linux/aarch64/clone.S:78

Thanks!

Hi zcs,
Please check patch newly upated in #4
It adds checking validness of SPS.

We will check the segment fault, but for released BSP(r28.2.1, r28.3, r32.1), we suggest you add the check in application.

Hi, DaneLLL

Thank you for your reply.

We’ll wait for this repair.

Thanks!