On 10/27/2013 01:18 PM, Vittorio Giovara wrote:
> ---
>  libavformat/wtv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/wtv.c b/libavformat/wtv.c
> index b144eb6..b150e21 100644
> --- a/libavformat/wtv.c
> +++ b/libavformat/wtv.c
> @@ -525,7 +525,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, 
> const char *key, int ty
>          else
>              snprintf(buf, buf_size, "%"PRIi64, num);
>      } else if (type == 5 && length == 2) {
> -        snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
> +        snprintf(buf, buf_size, "%"PRIi16, (short int) avio_rl16(pb));
>      } else if (type == 6 && length == 16) {
>          ff_asf_guid guid;
>          avio_read(pb, guid, 16);

avio_rl16() returns unsigned int. If the intent is to treat it as signed
16-bit, just casting it like that has implementation-defined behavior.
The correct way to do this would be with a union (for an example see
libavcodec/mathops.h:ff_u8_to_s8() or libavutil/intreadwrite.h:av_alias*)

-Justin

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to