[FFmpeg-devel] [PATCH] Adding support for OSX bundles to ffmpeg command line
Chris Marrin
chris
Fri Mar 20 22:34:08 CET 2009
On Mar 20, 2009, at 9:50 AM, M?ns Rullg?rd wrote:
> Chris Marrin <chris at marrin.com> writes:
>
>> @@ -3915,7 +3930,16 @@
>> {
>> int i;
>> int64_t ti;
>> -
>> +
>> + // get the executable path
>> + char* p = strrchr(argv[0], '/');
>> + if (p) {
>> + int length = p-argv[0];
>> + executable_path = av_malloc(length+1);
>> + strncpy(executable_path, argv[0], length);
>> + executable_path[length] = '\0';
>> + }
>> +
>
> There are a million ways in which this can fail.
I can find a few:
1) executable_path is not set to null if the if test fails (along with
the corresponding check for null where used).
2) The malloc can fail.
3) In the unimaginably unlikely case that argv[0] contained a string
of greater than 2GB with a slash at the end, the length would wrap
4) The executable_path is leaked (not a failure, but I can fix it)
I can fix all those. Others?
-----
~Chris
chris at marrin.com
More information about the ffmpeg-devel
mailing list