vlc filter plugin integer parameter overflow

This forum is about all development around libVLC.
aleksas
New Cone
New Cone
Posts: 4
Joined: 28 Aug 2016 16:52

vlc filter plugin integer parameter overflow

Postby aleksas » 11 May 2020 15:43

I'm trying to pass a 64 bit pointer to a data structure via plugin int parameter. From the plugin headers it looks that it deals with int64_t wich suggests that 64 bit pointer should not be a problem.
But when i'm passing a pointer value, what i get inside filter plugin is int32 max value (2,147,483,647).

Same experiment with 32 bit acts as expected. Pointer stays within 32 bit, value received in plugin is a valid pointer.

Is there some 32 bit limitation built in the plugin for int param?

p.s. the code resolving the parameter value

Code: Select all

struct filter_sys_t { atomic_llong i_shareddata }; atomic_init(&p_sys->i_shareddata, var_CreateGetIntegerCommand(p_filter, CFG_PREFIX "shareddata"));

aleksas
New Cone
New Cone
Posts: 4
Joined: 28 Aug 2016 16:52

Re: vlc filter plugin integer parameter overflow

Postby aleksas » 13 May 2020 15:43

UPDATE

Tried to use `_Atomic_address` together with `var_CreateGetAddress` function instead of `atomic_int` but the result is the same.

OS: Windows 10
VLC: 3.0.10

[url=https://stackoverflow.com/questions/61747918/vlc-filter-plugin-integer-parameter-overflow]Reposted[/url]

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc filter plugin integer parameter overflow

Postby Rémi Denis-Courmont » 13 May 2020 17:30

The range is INT64_MIN to INT64_MAX.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

aleksas
New Cone
New Cone
Posts: 4
Joined: 28 Aug 2016 16:52

Re: vlc filter plugin integer parameter overflow

Postby aleksas » 14 May 2020 14:52

The range is INT64_MIN to INT64_MAX.
That is what I would expect, but.. Repeated experiment shows different result:

On code controlling libvlc side:

Code: Select all

int64_t testvalue = 0x00000000FFFFFFFF; sprintf(sandbox_options, "sandboxfilter{testvalue=%lld}", testvalue);
gives: "sandboxfilter{testvalue=4294967295}"


which is passed as part of vlc_argv

on the filter side in Create function value is recovered using following code:

Code: Select all

struct filter_sys_t { atomic_int i_testvalue; }; (...) atomic_init(&p_sys->i_testvalue, var_CreateGetIntegerCommand(p_filter, CFG_PREFIX "testvalue"));
expected p_sys->i_testvalue value after this function is 4294967295 but it actually is 2147483647 (INT32_MAX)

setting testvalue to anything above 0x000000007FFFFFFF (INT32_MAX)

on filter side is set back to INT32_MAX .

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc filter plugin integer parameter overflow

Postby Rémi Denis-Courmont » 14 May 2020 17:31

With configuration chain, the range is LONG_MIN to LONG_MAX.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

aleksas
New Cone
New Cone
Posts: 4
Joined: 28 Aug 2016 16:52

Re: vlc filter plugin integer parameter overflow

Postby aleksas » 15 May 2020 13:49

The work around I use is to combine two long values into 64bit void *. Is there a better solution?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 17 guests