[vlc-commits] [Git][videolan/vlc][master] 3 commits: youtube.lua: fix crash on unexpected "n" descrambling transformation code
David (@dfuhrmann)
gitlab at videolan.org
Thu Sep 1 20:28:50 UTC 2022
David pushed to branch master at VideoLAN / VLC
Commits:
14944410 by Pierre Ynard at 2022-09-01T20:09:08+00:00
youtube.lua: fix crash on unexpected "n" descrambling transformation code
It was possible, when encountering different code from what was expected
for some known transformations, to void the code parsing pointer instead
of advancing it, resulting in a subsequent crash of the script and total
playback failure. Add a fallback and check, to prevent and gracefully
deal with this, and still allow playback, even if throttled, in case of
descrambling failure.
- - - - -
b735ef2c by Pierre Ynard at 2022-09-01T20:09:08+00:00
youtube.lua: don't silently fail on "n" descrambling script parsing
The descrambling script section was updated from a simple and linear
chain of calls, to a complex execution tree with conditional branches.
Failure to recognize and parse this call structure (or lack thereof)
resulted in a silent no-op. Add a check to properly report an error.
Ref #27227
- - - - -
90dcfa0e by Pierre Ynard at 2022-09-01T20:09:08+00:00
youtube.lua: bump up severity of "n" parameter throttling warning
Due to the severely increased complexity of "n" descrambling code, a
quick fix is unfortunately not foreseeable. For now, let users know more
clearly what's going on and what's to expect or not.
Ref #27227
- - - - -
1 changed file:
- share/lua/playlist/youtube.lua
Changes:
=====================================
share/lua/playlist/youtube.lua
=====================================
@@ -370,7 +370,7 @@ function n_descramble( nparam, js )
-- as such into a table.
local data = {}
datac = datac..","
- while datac ~= "" do
+ while datac and datac ~= "" do
local el = nil
-- Transformation functions
if string.match( datac, "^function%(" ) then
@@ -396,6 +396,7 @@ function n_descramble( nparam, js )
el == trans.compound1.func or
el == trans.compound2.func then
datac = string.match( datac, '^.-},e%.split%(""%)%)},(.*)$' )
+ or string.match( datac, "^.-},(.*)$" )
else
datac = string.match( datac, "^.-},(.*)$" )
end
@@ -459,6 +460,10 @@ function n_descramble( nparam, js )
-- as a second argument. We parse and emulate those calls to follow
-- the descrambling script.
-- c[40](c[14],c[2]),c[25](c[48]),c[14](c[1],c[24],c[42]()), [...]
+ if not string.match( script, "c%[(%d+)%]%(c%[(%d+)%]([^)]-)%)" ) then
+ vlc.msg.dbg( "Couldn't parse and execute YouTube video throttling parameter descrambling rules" )
+ return nil
+ end
for ifunc, itab, args in string.gmatch( script, "c%[(%d+)%]%(c%[(%d+)%]([^)]-)%)" ) do
local iarg1 = string.match( args, "^,c%[(%d+)%]" )
local iarg2 = string.match( args, "^,[^,]-,c%[(%d+)%]" )
@@ -703,8 +708,8 @@ function pick_stream( stream_map, js_url )
if dn then
url = string.gsub( url, "([?&])n=[^&]+", "%1n="..vlc.strings.encode_uri_component( dn ), 1 )
else
- vlc.msg.dbg( "Couldn't descramble YouTube throttling URL parameter: data transfer will get throttled" )
- vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
+ vlc.msg.err( "Couldn't descramble YouTube throttling URL parameter: data transfer will get throttled" )
+ --vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
end
end
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/49ff728d48005aac6d87ecfb8f8114fe07dedd51...90dcfa0e78081770ecbd0a072b96a277aea4a214
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/49ff728d48005aac6d87ecfb8f8114fe07dedd51...90dcfa0e78081770ecbd0a072b96a277aea4a214
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list