[FFmpeg-devel] Patch for heap corruption run time error in decklink_common.cpp

Ramiro Polla ramiro.polla at gmail.com
Wed Dec 3 00:35:32 CET 2014


On 02.12.2014 20:28, Jon bae wrote:
> Ok here a second run, I try to follow the instruction from Carl Eugen.
> This is the first patch for decklink_common.cpp. It fix this error:
>
>     Unhandled exception at 0x0000000076FA4102 (ntdll.dll) in ffmpeg.exe:
>     0xC0000374: A heap has been corrupted (parameters: 0x000000007701B4B0).

> From e9bc8e910f515af4030054df3e6feb308f3208aa Mon Sep 17 00:00:00 2001
> From: Jonathan Baecker <jonbae77 at gmail.com>
> Date: Tue, 2 Dec 2014 20:10:41 +0100
> Subject: [PATCH 1/2] heap corruption run time error in decklink_common
>
> Signed-off-by: Jonathan Baecker <jonbae77 at gmail.com>
> ---
>  libavdevice/decklink_common.cpp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
> index 9a9e44b..8eff910 100644
> --- a/libavdevice/decklink_common.cpp
> +++ b/libavdevice/decklink_common.cpp
> @@ -69,9 +69,12 @@ static char *dup_wchar_to_utf8(wchar_t *w)
>  }
>  #define DECKLINK_STR    OLECHAR *
>  #define DECKLINK_STRDUP dup_wchar_to_utf8
> +#define DECKLINK_FREE(s) SysFreeString(s)
>  #else
>  #define DECKLINK_STR    const char *
>  #define DECKLINK_STRDUP av_strdup
> +/* free() is needed for a string returned by the DeckLink SDL. */
> +#define DECKLINK_FREE(s) free((void *) s)
>  #endif
>
>  HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName)
> @@ -81,8 +84,7 @@ HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName)
>      if (hr != S_OK)
>          return hr;
>      *displayName = DECKLINK_STRDUP(tmpDisplayName);
> -    /* free() is needed for a string returned by the DeckLink SDL. */
> -    free((void *) tmpDisplayName);
> +    DECKLINK_FREE(tmpDisplayName);
>      return hr;
>  }

LGTM


More information about the ffmpeg-devel mailing list