[FFmpeg-devel] lavf/rtmpcrypt: Add a cast to silence a warning

Submitted by Carl Eugen Hoyos on April 15, 2018, 10:19 p.m.

Details

Message ID CAB0OVGodiAJQ4hMmmMs3OASSnzB6JO+76YvEm090QfV_BRDioA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos April 15, 2018, 10:19 p.m.
Hi!

rtmpe_write() exploits knowledge about av_rc4_crypt() internals and
passes the same
pointer as src and dst. I assume this is intentional for performance
reasons, the only
way to silence the resulting warning is a cast afaict.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos April 18, 2018, 6:33 p.m.
2018-04-16 0:19 GMT+02:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> Hi!
>
> rtmpe_write() exploits knowledge about av_rc4_crypt() internals and
> passes the same
> pointer as src and dst. I assume this is intentional for performance
> reasons, the only
> way to silence the resulting warning is a cast afaict.

I will push this if there are no comments.

Carl Eugen
Reino Wijnsma April 21, 2018, 10:52 p.m.
On 16-4-2018 0:19, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> rtmpe_write() exploits knowledge about av_rc4_crypt() internals and
> passes the same
> pointer as src and dst. I assume this is intentional for performance
> reasons, the only
> way to silence the resulting warning is a cast afaict.
>
> Please comment, Carl Eugen
$ make libavformat/rtmpcrypt.o
CC      libavformat/rtmpcrypt.o

No more warning.

-- Reino
Reino Wijnsma April 26, 2018, 11:34 a.m.
On 22-4-2018 0:52, Reino Wijnsma <rwijnsma@xs4all.nl> wrote:
> On 16-4-2018 0:19, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> rtmpe_write() exploits knowledge about av_rc4_crypt() internals and
>> passes the same
>> pointer as src and dst. I assume this is intentional for performance
>> reasons, the only
>> way to silence the resulting warning is a cast afaict.
>>
>> Please comment, Carl Eugen
> $ make libavformat/rtmpcrypt.o
> CC      libavformat/rtmpcrypt.o
>
> No more warning.
Hello Carl,

Are you going to push this patch as well?

-- Reino
Carl Eugen Hoyos April 26, 2018, 11:42 a.m.
2018-04-26 13:34 GMT+02:00, Reino Wijnsma <rwijnsma@xs4all.nl>:
> On 22-4-2018 0:52, Reino Wijnsma <rwijnsma@xs4all.nl> wrote:
>> On 16-4-2018 0:19, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>>> rtmpe_write() exploits knowledge about av_rc4_crypt() internals and
>>> passes the same
>>> pointer as src and dst. I assume this is intentional for performance
>>> reasons, the only
>>> way to silence the resulting warning is a cast afaict.
>>>
>>> Please comment, Carl Eugen
>> $ make libavformat/rtmpcrypt.o
>> CC      libavformat/rtmpcrypt.o
>>
>> No more warning.
> Hello Carl,
>
> Are you going to push this patch as well?

I wanted to request a documentation update
for av_rc4_crypt() first but I realize it is
already there;-)

Will push, Carl Eugen

Patch hide | download patch | download mbox

From 397b209506beb6c5a2acbe19bba98393216f1d0c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Mon, 16 Apr 2018 00:14:24 +0200
Subject: [PATCH] lavf/rtmpcrypt: Add a cast to silence an unavoidable
 warning.

Silences the following warning:
libavformat/rtmpcrypt.c:304:36: warning: passing argument 2 of 'av_rc4_crypt' discards 'const' qualifier from pointer target type
---
 libavformat/rtmpcrypt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtmpcrypt.c b/libavformat/rtmpcrypt.c
index c41ae43..253b8ca 100644
--- a/libavformat/rtmpcrypt.c
+++ b/libavformat/rtmpcrypt.c
@@ -301,7 +301,7 @@  static int rtmpe_write(URLContext *h, const uint8_t *buf, int size)
 
     if (rt->handshaked) {
         /* encrypt data to send to the server */
-        av_rc4_crypt(&rt->key_out, buf, buf, size, NULL, 1);
+        av_rc4_crypt(&rt->key_out, (uint8_t *)buf, buf, size, NULL, 1);
     }
 
     if ((ret = ffurl_write(rt->stream, buf, size)) < 0)
-- 
1.7.10.4