Skip to content

fix(avi_player): strl_parser fail cause divide zero bug#689

Open
flespark wants to merge 1 commit into
espressif:masterfrom
flespark:fix/avi_player_divide_zero_bug
Open

fix(avi_player): strl_parser fail cause divide zero bug#689
flespark wants to merge 1 commit into
espressif:masterfrom
flespark:fix/avi_player_divide_zero_bug

Conversation

@flespark
Copy link
Copy Markdown

@flespark flespark commented Apr 1, 2026

Description

In avi_player, if strl_parser have not parse any valid video stream, avi_parser still return 0, avi_player function will step onto remain data parse process, run into divide zero panic at uint32_t fps_time = 1000 * 1000 / s_avi->avi_data.AVI_file.vids_fps;

Note

Found and fixed in avi_player v1.0.0, log as follow:
I (29432) avifile: Find a video stream
E (29432) avifile: only support mjpeg\h264 decoder, but needed is 0x34504d46
E (29432) avifile: strl of stream0 prase failed
I (29432) avifile: movi pos:5678, size:48502
I (29432) REST_SERVER: check_avi_format: AVI info - 0x0 @ 0 fps, MJPEG format
I (29442) REST_SERVER: check_avi_format: file format is supported
I (29622) REST_SERVER: file finalized: /nvm/video_1774769102890.avi

E (871) avifile: only support mjpeg\h264 decoder, but needed is 0x34504d46
E (871) avifile: strl of stream0 prase failed
I (871) avifile: movi pos:5678, size:48502
Guru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was unhandled.

Core 0 register dump:
PC : 0x4201a75f PS : 0x00060730 A0 : 0x8201a95d A1 : 0x3fce5df0
--- 0x4201a75f: avi_player at /Users/simon/Project/esp_player/sw_v1/managed_components/espressif__avi_player/avi_player.c:153

A2 : 0x00000002 A3 : 0x0000000f A4 : 0x3fce4f6c A5 : 0x00010000
A6 : 0xffffffff A7 : 0x3fcac464 A8 : 0x3fce4ec8 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x3c166350 A12 : 0x000f4240 A13 : 0x5453494c
A14 : 0x69766f6d A15 : 0x3c167972 SAR : 0x00000004 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffffd
--- 0x400556d5: strlen in ROM
--- 0x400556e5: strlen in ROM

test video file attached
新建文件夹.zip

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants