Opened 13 years ago

Closed 13 years ago

Last modified 13 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 Khokhlov Owned by: Michael Niedermayer
Priority: normal Component: avformat
Version: git Keywords: nutdec
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

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 by Stefano Sabatini, 13 years ago

Analyzed by developer: set
Component: avutilavformat
Resolution: invalid
Status: newclosed

The last part of the function is:

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

assert(0);
}

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 by Alex Khokhlov, 13 years ago

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 by Carl Eugen Hoyos, 13 years ago

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.