Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#211 closed defect (invalid)

Function static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit) haven't got return operator after assert(0)

Reported by: Alex Owned by: michael
Priority: normal Component: avformat
Version: git Keywords: nutdec
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes


Look on libavutil/nutdec.c
Function static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit) that starts from the line 831.
It has to return int64_t value but the end of the function haven't got any return operators.

I propose to put there return AV_NOPTS_VALUE; as the last line of the function.

Change History (3)

comment:1 Changed 5 years ago by saste

  • Analyzed by developer set
  • Component changed from avutil to avformat
  • Resolution set to invalid
  • Status changed from new to closed

The last part of the function is:

if (stream_index == -1) return pts;
else if(stream_index == -2) return back_ptr;


So the function will either return a value or assert, because the condition is unexpected, so I don't believe there is an error here. Maybe some graceful recovery code could be put, but if there are no samples raising the assert condition (and possibly it is not even possible, unless there are programming errors), then I believe the issue can be safely closed.

Let us know if you if you don't agree or if there are samples which can raise the assert.

comment:2 Changed 5 years ago by Alex

Your explanation is absolutly clearly bu there are two issues:
1) assert(0) works only for debug build. In the release the function returns some garbage without any diagnostic messages.

2)When I tried to build ffmpeg I cought the next compiler error:

external/ffmpeg/libavformat/nutdec.c: In function 'nut_read_timestamp':
external/ffmpeg/libavformat/nutdec.c:855: error: control reaches end of non-void function

Hint: I built ffmpeg for Android so some differences in build environment are present

comment:3 Changed 5 years ago by cehoyos

Then please:
(for future reports) start with your issue, you may or may not add a fix, but the fix without the issue is not useful.
(for this report) provide your configure line, confirm that you did not change config.* (consider attaching them) or any source files, and provide the complete, uncut output of a second (or third) call to make V=1
(Please do not add the complete, uncut output of make V=1 without running make before!)

Note: See TracTickets for help on using tickets.