Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Invalid regular expression: missing / #1131

Closed
kiri836 opened this issue Sep 1, 2022 · 20 comments · Fixed by #1137
Closed

SyntaxError: Invalid regular expression: missing / #1131

kiri836 opened this issue Sep 1, 2022 · 20 comments · Fixed by #1137
Labels

Comments

@kiri836
Copy link

kiri836 commented Sep 1, 2022

node:events:498
      throw er; // Unhandled 'error' event
      ^

evalmachine.<anonymous>:13
-1929233002,b,/,][};Xka(ncode);
              ^

SyntaxError: Invalid regular expression: missing /
    at new Script (node:vm:100:7)
    at Object.exports.decipherFormats (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\sig.js:116:51)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async exports.getInfo (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\info.js:401:17)
Emitted 'error' event on B instance at:
    at OggDemuxer.t (C:\Users\user\Documents\bot rewrite\node_modules\@discordjs\voice\dist\index.js:8:288)
    at Object.onceWrapper (node:events:640:26)
    at OggDemuxer.emit (node:events:532:35)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  resource: <ref *3> T {
    playStream: OggDemuxer {
      _readableState: ReadableState {
        objectMode: true,
        highWaterMark: 16,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: [],
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        constructed: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: true,
        resumeScheduled: false,
        errorEmitted: true,
        emitClose: true,
        autoDestroy: true,
        destroyed: true,
        errored: evalmachine.<anonymous>:13
        -1929233002,b,/,][};Xka(ncode);
                      ^

        SyntaxError: Invalid regular expression: missing /
            at new Script (node:vm:100:7)
            at Object.exports.decipherFormats (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\sig.js:116:51)
            at runMicrotasks (<anonymous>)
            at processTicksAndRejections (node:internal/process/task_queues:96:5)
            at async Promise.all (index 0)
            at async exports.getInfo (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\info.js:401:17),
        closed: true,
        closeEmitted: false,
        defaultEncoding: 'utf8',
        awaitDrainWriters: null,
        multiAwaitDrain: false,
        readingMore: false,
        dataEmitted: false,
        decoder: null,
        encoding: null,
        [Symbol(kPaused)]: null
      },
      _events: [Object: null prototype] {
        prefinish: [Function: prefinish],
        close: [
          [Function (anonymous)],
          [Function: onclose],
          [Function: bound onceWrapper] { listener: [Function: s] }
        ],
        end: [
          [Function: onend],
          [Function: bound onceWrapper] { listener: [Function: s] }
        ],
        finish: [
          [Function: onfinish],
          [Function: bound onceWrapper] { listener: [Function: s] }
        ],
        error: [Function: onerror],
        readable: [
          [Function: bound onceWrapper] {
            listener: [Function (anonymous)]
          },
          [Function: bound onceWrapper] { listener: [Function: o] }
        ]
      },
      _eventsCount: 6,
      _maxListeners: undefined,
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: true,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        afterWriteTickInfo: null,
        buffered: [],
        bufferedIndex: 0,
        allBuffers: true,
        allNoop: true,
        pendingcb: 0,
        constructed: true,
        prefinished: false,
        errorEmitted: true,
        emitClose: true,
        autoDestroy: true,
        errored: evalmachine.<anonymous>:13
        -1929233002,b,/,][};Xka(ncode);
                      ^

        SyntaxError: Invalid regular expression: missing /
            at new Script (node:vm:100:7)
            at Object.exports.decipherFormats (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\sig.js:116:51)
            at runMicrotasks (<anonymous>)
            at processTicksAndRejections (node:internal/process/task_queues:96:5)
            at async Promise.all (index 0)
            at async exports.getInfo (C:\Users\user\Documents\bot rewrite\node_modules\ytdl-core\lib\info.js:401:17),
        closed: true,
        closeEmitted: false,
        [Symbol(kOnFinished)]: []
      },
      allowHalfOpen: true,
      _remainder: null,
      _head: null,
      _bitstream: null,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    edges: [
      <ref *1> {
        type: 'ffmpeg ogg',
        to: _e {
          edges: [ [Object], [Object], [Object] ],
          type: 'ogg/opus'
        },
        cost: 2,
        transformer: [Function: transformer],
        from: _e { edges: [ [Object], [Circular *1] ], type: 'arbitrary' }
      },
      <ref *2> {
        type: 'ogg/opus demuxer',
        to: _e { edges: [ [Object] ], type: 'opus' },
        cost: 1,
        transformer: [Function: transformer],
        from: _e {
          edges: [ [Circular *2], [Object], [Object] ],
          type: 'ogg/opus'
        }
      }
    ],
    metadata: null,
    volume: undefined,
    encoder: undefined,
    audioPlayer: <ref *4> B {
      _events: [Object: null prototype] { stateChange: [Function (anonymous)] },
      _eventsCount: 1,
      _maxListeners: undefined,
      _state: {
        status: 'buffering',
        resource: [Circular *3],
        onReadableCallback: [Function: o],
        onFailureCallback: [Function: s],
        onStreamError: [Function: t]
      },
      subscribers: [
        O {
          connection: G {
            _events: [Object: null prototype],
            _eventsCount: 1,
            _maxListeners: undefined,
            rejoinAttempts: 0,
            _state: [Object],
            joinConfig: [Object],
            packets: [Object],
            receiver: [j],
            debug: null,
            onNetworkingClose: [Function: bound onNetworkingClose],
            onNetworkingStateChange: [Function: bound onNetworkingStateChange],
            onNetworkingError: [Function: bound onNetworkingError],
            onNetworkingDebug: [Function: bound onNetworkingDebug],
            [Symbol(kCapture)]: false
          },
          player: [Circular *4]
        }
      ],
      behaviors: { noSubscriber: 'pause', maxMissedFrames: 5 },
      debug: [Function (anonymous)],
      [Symbol(kCapture)]: false
    },
    playbackDuration: 0,
    started: false,
    silencePaddingFrames: 5,
    silenceRemaining: -1
  }
}

Not really sure the reason behind this, started happening after switching to version 4.11.1 from 4.10.0. Switching back to version 4.10.0 fixed the issue. Not sure about other versions.

Any youtube link supplied will output the error above. This is the only ytdl method I have in my code (except for a few ytdl.validateURL methods):

stream = createAudioResource(ytdl(videoURL, { 
	filter: "audioonly",
        fmt: "mp3",
	highWaterMark: 1 << 62,
	liveBuffer: 1 << 62,
	dlChunkSize: 0,
	bitrate: 128 }));
return stream;

The variable videoURL is supplied with this: https://www.youtube.com/watch?v=${res.data.items[0].id} where ${res.data.items[0].id} is gotten from using the youtube api. I checked if the output of ytdl.validateURL(videoURL) is true, which it was every time.

@EdenwareApps
Copy link

Same here. It was working a few hours ago with the same files and version.

@LuanRT
Copy link

LuanRT commented Sep 1, 2022

Seems like player c57c113c added some more bogus regex to the nsig code.

nsig descrambling function

Xka = function (a) {
  var b = a.split(""),
    c = [function () {
        for (var d = 64, e = []; ++d - e.length - 32;) switch (d) {
        case 58:
          d = 96;
          continue;
        case 91:
          d = 44;
          break;
        case 65:
          d = 47;
          continue;
        case 46:
          d = 153;
        case 123:
          d -= 58;
        default:
          e.push(String.fromCharCode(d))
        }
        return e
      },
      -179078025, -338229892, 1876903987, 761078276, -2142957496,
      function (d, e) {
        d = (d % e.length + e.length) % e.length;
        e.splice(d, 1)
      },
      function (d, e, f, h, l) {
        return e(f, h, l)
      },
      1863880563, -1446307769, 1338823641, 418803989,
      function (d, e) {
        for (d = (d % e.length + e.length) % e.length; d--;) e.unshift(e.pop())
      },
      794127342, 1631485018, -1367624514, -179078025, "mjVhn", 969121859, 969121859, "while", 1466130806, -1414338504, 1065490076,
      function (d, e, f) {
        var h = e.length;
        f.forEach(function (l, m, n) {
          this.push(n[m] = e[(e.indexOf(l) - e.indexOf(this[m]) + m + h--) % e.length])
        }, d.split(""))
      },
      899502571,
      function () {
        for (var d = 64, e = []; ++d - e.length - 32;) {
          switch (d) {
          case 91:
            d = 44;
            continue;
          case 123:
            d = 65;
            break;
          case 65:
            d -= 18;
            continue;
          case 58:
            d = 96;
            continue;
          case 46:
            d = 95
          }
          e.push(String.fromCharCode(d))
        }
        return e
      },
      -1150284080, ",\",';,[", 1, 3, null, "yzljiC", 761078276, 1899843280, -1083939750, 4, 1673880209, 912775572, 0, 6360865, -774686699, -1792529432, "z6iCy3-", 827595161,
      function () {
        for (var d = 64, e = []; ++d - e.length - 32;) switch (d) {
        case 46:
          d = 95;
        default:
          e.push(String.fromCharCode(d));
        case 94:
        case 95:
        case 96:
          break;
        case 123:
          d -= 76;
        case 92:
        case 93:
          continue;
        case 58:
          d = 44;
        case 91:
        }
        return e
      },
      -1381942510, -838334235,
      function (d, e, f, h, l, m, n, p, q) {
        return f(n, p, q)
      },
      b, null, 2068888309, -1058121460,
      function (d, e, f, h, l, m) {
        return e(h, l, m)
      },
      function (d) {
        for (var e = d.length; e;) d.push(d.splice(--e, 1)[0])
      },
      -2142957496, -1950261783, "6TPG", -561102166,
      function (d, e, f, h, l, m, n, p) {
        return e(f, h, l, m, n, p)
      },
      "RooADZ", 1211065044, -1792534961, "Z9F5L", "RooADZ",
      function () {
        for (var d = 64, e = []; ++d - e.length - 32;) {
          switch (d) {
          case 58:
            d -= 14;
          case 91:
          case 92:
          case 93:
            continue;
          case 123:
            d = 47;
          case 94:
          case 95:
          case 96:
            continue;
          case 46:
            d = 95
          }
          e.push(String.fromCharCode(d))
        }
        return e
      },
      -1929233002, b, /,][}",],()}(\[)/, 2070160835, 1561177444, "WLj5rG", 1466220618, "p3tDqcw", -1111863405,
      function (d) {
        d.reverse()
      },
      "GIUiubS", "NHyWmP", b, 6, -2073883908, -1644137405,
      function (d, e, f, h, l, m, n) {
        return d(l, m, n)
      },
      -1260056024, 801002042, 217527420, 686947973,
      function (d, e, f, h, l, m, n, p, q, t, w) {
        return f(m, n, p, q, t, w)
      },
      function (d, e) {
        d = (d % e.length + e.length) % e.length;
        e.splice(-d).reverse().forEach(function (f) {
          e.unshift(f)
        })
      },
      271858095, null,
      function (d, e) {
        e = (e % d.length + d.length) % d.length;
        var f = d[0];
        d[0] = d[e];
        d[e] = f
      },
      242936683, 1954280329,
      function (d, e) {
        e = (e % d.length + d.length) % d.length;
        d.splice(0, 1, d.splice(e, 1, d[0])[0])
      },
      -933042511, -1827808213, 88251346, 7, 39714317, -1573123642,
      function (d, e) {
        e.push(d)
      },
      -367931876, "qOm9j81", -1637137240, "12GRBB"
    ];
  c[31] = c;
  c[50] = c;
  c[90] = c;
  try {
    try {
      0 < c[36] ? (((0, c[12])(c[25], c[50]), (0, c[40])((0, c[2])(c[Math.pow(4, 1) + 20667 - 20666]), c[18], c[83], c[74]), c[21])(c[64], c[19]), (0, c[21])(c[83], c[73]), c[45])(c[86 + 16 % Math.pow(5, 2)], c[64]) : (0, c[7])((0, c[60])(c[63], c[26]), c[1], (0, c[61])((0, c[42])(c[104], c[Math.pow(6, 5) - 16 - new Date("31 December 1969 19:08:52 MST") / 1E3]), c[78], c[5], (0, c[99])(), c[103]), c[60], (0, c[-19125 + Math.pow(6, 1) + 19180])((0, c[23])(c[21]), c[60], c[18], c[103]), c[52],
        c[15]), c[new Date("Wednesday 31 December 1969 20:01:30 EDT") / 1E3] > -590645 - -246 * Math.pow(7, 4) && ((((0, c[61])((0, c[36])(c[29], c[21]), c[104], c[102]), c[69])((0, c[1])(c[45]), c[14], c[1], c[75]), c[104])(c[78]), c[Math.pow(3, 3) % 64 - -8])(c[34], c[96]), (0, c[53])(c[Math.pow(1, 2) - 8228 - -8320], (0, c[29])(), c[56]), (0, c[53])(c[46], (0, c[74])(), c[78])
    } catch (d) {
      8 >= c[21] && (0, c[17])(c[60], c[87]), 6 >= c[59] && (c[59] <= new Date("December 31 1969 18:00:09 MDT") / 1E3 && ((0, c[79 + Math.pow(3, 2) % 331])((0, c[11])(c[30], c[249 + -31 * Math.pow(2,
        3)]), c[82], (0, c[17])(c[102], c[62]), c[14], (0, c[77])((0, c[35])(c[7], c[1]), (0, c[35])(c[67], c[96]), c[14], (0, c[24])(c[103], c[79]), (0, c[17])(c[96], c[39]), (0, c[14])(c[96], c[43]), c[79], c[103]), c[1], c[90]), {}) || (0, c[77])((0, c[78])((0, c[104])(c[1]), c[83], c[102]), (0, c[35])(c[19], c[79]), c[11], ((0, c[14])(c[1], c[16]), c[new Date("1969-12-31T19:00:11.000-05:00") / 1E3])(c[95], c[24]), (0, c[78])((0, c[53])(c[100], (0, c[29])(), c[1]), c[104], c[79]), (0, c[14])(c[79], c[37]), c[52], c[121 - 120 % Math.pow(7, 5)]))
    }
    try {
      5 >= c[65] && ((0, c[10])((0, c[78])((0, c[78])((0, c[104])(c[60]),
        c[53], c[93], (0, c[32])(), c[82]), c[71], c[88], c[14 - 260 % Math.pow(2, 3)]), (0, c[89])(c[new Date("January 01 1970 08:15:27 +0815") / 1E3], c[58]), c[28], (0, c[95])(c[81], c[246 * Math.pow(5, 4) + -153740]), (0, c[28])((0, c[53])(c[34], (0, c[32])(), c[105]), c[95], c[40], c[82]), (0, c[89])(c[82], c[30]), c[92], c[new Date("January 01 1970 08:00:10 +0800") / 1E3], c[62]), 1) || (((0, c[65])(c[100], c[82]), c[53])(c[13], (0, c[77])(), c[new Date("1969-12-31T18:00:10.000-06:00") / 1E3]), ((((0, c[2])(c[4]), c[92])(c[4], c[86]), c[65])(c[98], c[4]), (0, c[23])(c[27]),
        c[65])(c[83], c[10]), (0, c[Math.pow(7, 5) % 121 + -56])(c[80], (0, c[32])(), c[10]), c[65])(c[64], c[82])
    } catch (d) {
      (0, c[71])(c[94], c[82])
    } finally {
      8 >= c[Math.pow(3, 5) - 15857 + 15662] && (1 < c[85] || (((0, c[28])((0, c[18])((0, c[28])((0, c[53])(c[14], (0, c[77])(), c[82]), c[89], c[27], c[97]), c[28], (0, c[89])(c[27], c[35]), c[71], c[75], c[105]), c[71], c[42], c[new Date("Wednesday December 31 1969 17:01:22 MST") / 1E3]), c[24])((0, c[53])(c[1], (0, c[51])(), c[82]), c[95], (0, c[53])(c[45], (0, c[12])(), c[10]), c[21], c[27]) !== (0, c[53])(c[78], (0, c[12])(),
        c[82]), null)) && (0, c[18])((0, c[101])(c[Math.pow(7, 4) % 356 + -170], (0, c[24])((0, c[28])((0, c[92])(c[10], c[56]), c[65], c[43], c[46]), c[54], (0, c[60])(c[15], c[76]), c[22], c[92]), (0, c[Math.pow(4, 4) + -22264 + 22091])(c[44], c[22]), (0, c[87])(c[12324 - Math.pow(2, 1) + -12246], c[19]), c[87], c[25 - Math.pow(4, 1) % 357]), c[49], (0, c[9])(c[87], c[48]), c[6], c[43], c[16])
    }
    try {
      1 < c[103] && (2 < c[56] && ((0, c[71])(c[75], (0, c[69])(), c[16]), 1) || (0, c[3])(c[16], c[73])), (0, c[46])((0, c[89])(c[22], c[Math.pow(1, 3) % 132 + 98]), c[71], c[88], (0, c[69])(), c[16])
    } catch (d) {
      (c[15] <=
        new Date("Wednesday 31 December 1969 20:45:06 -0315") / 1E3 || ((0, c[89])(c[Math.pow(7, 2) + 227 % (new Date("1969-12-31T12:31:43.000-11:30") / 1E3) + -19], c[16]), Math.pow(5, 4) + 124 - new Date("Wednesday 31 December 1969 17:12:29 MST") / 1E3)) && (0, c[3])(c[16], c[33])
    }
  } catch (d) {
    return "enhanced_except_o5YB3On-_w8_" + a
  }
  return b.join("")
};

And /,][}",],()}(\[)/ is what's causing extraction to fail.

@JoshuaDarron
Copy link

Seems like player c57c113c added some more bogus regex to the nsig code.

nsig descrambling function
And /,][}",],()}(\[)/ is what's causing extraction to fail.

if this is the issue
do you know what the fix would be?

@dsnsgithub
Copy link

dsnsgithub commented Sep 1, 2022

Found a fix: #1111

Same solution as the previous regex errors.

@pratamaid
Copy link

Yesterday I upgraded from 4.11.0 to 4.11.1 and my program was running smoothly but today when I try the error appears as above

@efefurkankarakaya
Copy link

Same here.

Found a fix: #1111

Same solution as the previous regex errors.

Thanks, it's working.

@gatecrasher777
Copy link
Contributor

gatecrasher777 commented Sep 1, 2022

The problem is that cutAfterJS() in util.js is not identifying

   /,][}",],()}(\[)/

as a regular expression, and thus } short circuits the code extraction.

AlexanderWyss added a commit to AlexanderWyss/discord-bot-node that referenced this issue Sep 1, 2022
@nukeop
Copy link

nukeop commented Sep 1, 2022

What needs to happen for G**gle developers to stop fucking around with the streams?

@Heknon
Copy link

Heknon commented Sep 1, 2022

Found a fix: #1111

Same solution as the previous regex errors.

Working, thanks
Changed the extractNCode function in sig.js to this as per the pr:

const extractNCode = () => {
    let functionName = utils.between(body, `&&(b=a.get("n"))&&(b=`, `(b)`);
    if (functionName.includes('[')) functionName = utils.between(body, `${functionName.split('[')[0]}=[`, `]`);
    if (functionName && functionName.length) {
      const functionStart = `${functionName}=function(a)`;
      const ndx = body.indexOf(functionStart);
      if (ndx >= 0) {
        const end = body.indexOf('.join("")};', ndx);
        const subBody = body.slice(ndx, end);
        const functionBody = `${subBody}.join("")};${functionName}(ncode);`;
        functions.push(functionBody);
      }
    }
  };

@imagineeeinc
Copy link

So, do we have to wait for a fix or will I have to fix it my self, if so can someone point me in the right direction

@JoaoZanetti
Copy link

JoaoZanetti commented Sep 1, 2022

So, do we have to wait for a fix or will I have to fix it my self, if so can someone point me in the right direction

  1. cd node_modules/ytdl-core/lib
  2. open sig.js
  3. Go to line 64 and replace
const subBody = body.slice(ndx + functionStart.length);
const functionBody = `var ${functionStart}${utils.cutAfterJS(subBody)};${functionName}(ncode);`;

with

const end = body.indexOf('.join("")};', ndx);
const subBody = body.slice(ndx, end);
const functionBody = `${subBody}.join("")};${functionName}(ncode);`;

@kiri836
Copy link
Author

kiri836 commented Sep 1, 2022

Thank you everyone. Seems the issue is resolved with #1111 #1126 and I am assuming that it will be fixed with the next version, so I'm closing the issue.

@kiri836 kiri836 closed this as completed Sep 1, 2022
@meleyal
Copy link

meleyal commented Sep 1, 2022

@kiri836 #1111 was closed in favour of #1126

@nukeop
Copy link

nukeop commented Sep 1, 2022

Doesn't look likely, that was a separate issue 6 days ago, this is another one. Please reopen.

@gatecrasher777
Copy link
Contributor

As mentioned above the fix in PR #1126 cutAfterJS() is not identifying this Regex pattern:

 /,][}",],()}(\[)/

Probably just a small tweak is needed. Do not close this issue.
Ping @TimeForANinja

@WaqasIbrahim
Copy link
Contributor

Whoever is having this issue, please attach base.js file as well.

@kiri836 kiri836 reopened this Sep 1, 2022
@gatecrasher777
Copy link
Contributor

The N-transform function from base.js (same as in OP)

Xka=function(a){var b=a.split(""),c=[function(){for(var d=64,e=[];++d-e.length-32;)switch(d){case 58:d=96;continue;case 91:d=44;break;case 65:d=47;continue;case 46:d=153;case 123:d-=58;default:e.push(String.fromCharCode(d))}return e},
-179078025,-338229892,1876903987,761078276,-2142957496,function(d,e){d=(d%e.length+e.length)%e.length;e.splice(d,1)},
function(d,e,f,h,l){return e(f,h,l)},
1863880563,-1446307769,1338823641,418803989,function(d,e){for(d=(d%e.length+e.length)%e.length;d--;)e.unshift(e.pop())},
794127342,1631485018,-1367624514,-179078025,"mjVhn",969121859,969121859,"while",1466130806,-1414338504,1065490076,function(d,e,f){var h=e.length;f.forEach(function(l,m,n){this.push(n[m]=e[(e.indexOf(l)-e.indexOf(this[m])+m+h--)%e.length])},d.split(""))},
899502571,function(){for(var d=64,e=[];++d-e.length-32;){switch(d){case 91:d=44;continue;case 123:d=65;break;case 65:d-=18;continue;case 58:d=96;continue;case 46:d=95}e.push(String.fromCharCode(d))}return e},
-1150284080,",\",';,[",1,3,null,"yzljiC",761078276,1899843280,-1083939750,4,1673880209,912775572,0,6360865,-774686699,-1792529432,"z6iCy3-",827595161,function(){for(var d=64,e=[];++d-e.length-32;)switch(d){case 46:d=95;default:e.push(String.fromCharCode(d));case 94:case 95:case 96:break;case 123:d-=76;case 92:case 93:continue;case 58:d=44;case 91:}return e},
-1381942510,-838334235,function(d,e,f,h,l,m,n,p,q){return f(n,p,q)},
b,null,2068888309,-1058121460,function(d,e,f,h,l,m){return e(h,l,m)},
function(d){for(var e=d.length;e;)d.push(d.splice(--e,1)[0])},
-2142957496,-1950261783,"6TPG",-561102166,function(d,e,f,h,l,m,n,p){return e(f,h,l,m,n,p)},
"RooADZ",1211065044,-1792534961,"Z9F5L","RooADZ",function(){for(var d=64,e=[];++d-e.length-32;){switch(d){case 58:d-=14;case 91:case 92:case 93:continue;case 123:d=47;case 94:case 95:case 96:continue;case 46:d=95}e.push(String.fromCharCode(d))}return e},
-1929233002,b,/,][}",],()}(\[)/,2070160835,1561177444,"WLj5rG",1466220618,"p3tDqcw",-1111863405,function(d){d.reverse()},
"GIUiubS","NHyWmP",b,6,-2073883908,-1644137405,function(d,e,f,h,l,m,n){return d(l,m,n)},
-1260056024,801002042,217527420,686947973,function(d,e,f,h,l,m,n,p,q,t,w){return f(m,n,p,q,t,w)},
function(d,e){d=(d%e.length+e.length)%e.length;e.splice(-d).reverse().forEach(function(f){e.unshift(f)})},
271858095,null,function(d,e){e=(e%d.length+d.length)%d.length;var f=d[0];d[0]=d[e];d[e]=f},
242936683,1954280329,function(d,e){e=(e%d.length+d.length)%d.length;d.splice(0,1,d.splice(e,1,d[0])[0])},
-933042511,-1827808213,88251346,7,39714317,-1573123642,function(d,e){e.push(d)},
-367931876,"qOm9j81",-1637137240,"12GRBB"];c[31]=c;c[50]=c;c[90]=c;try{try{0<c[36]?(((0,c[12])(c[25],c[50]),(0,c[40])((0,c[2])(c[Math.pow(4,1)+20667-20666]),c[18],c[83],c[74]),c[21])(c[64],c[19]),(0,c[21])(c[83],c[73]),c[45])(c[86+16%Math.pow(5,2)],c[64]):(0,c[7])((0,c[60])(c[63],c[26]),c[1],(0,c[61])((0,c[42])(c[104],c[Math.pow(6,5)-16-new Date("31 December 1969 19:08:52 MST")/1E3]),c[78],c[5],(0,c[99])(),c[103]),c[60],(0,c[-19125+Math.pow(6,1)+19180])((0,c[23])(c[21]),c[60],c[18],c[103]),c[52],
c[15]),c[new Date("Wednesday 31 December 1969 20:01:30 EDT")/1E3]>-590645- -246*Math.pow(7,4)&&((((0,c[61])((0,c[36])(c[29],c[21]),c[104],c[102]),c[69])((0,c[1])(c[45]),c[14],c[1],c[75]),c[104])(c[78]),c[Math.pow(3,3)%64- -8])(c[34],c[96]),(0,c[53])(c[Math.pow(1,2)-8228- -8320],(0,c[29])(),c[56]),(0,c[53])(c[46],(0,c[74])(),c[78])}catch(d){8>=c[21]&&(0,c[17])(c[60],c[87]),6>=c[59]&&(c[59]<=new Date("December 31 1969 18:00:09 MDT")/1E3&&((0,c[79+Math.pow(3,2)%331])((0,c[11])(c[30],c[249+-31*Math.pow(2,
3)]),c[82],(0,c[17])(c[102],c[62]),c[14],(0,c[77])((0,c[35])(c[7],c[1]),(0,c[35])(c[67],c[96]),c[14],(0,c[24])(c[103],c[79]),(0,c[17])(c[96],c[39]),(0,c[14])(c[96],c[43]),c[79],c[103]),c[1],c[90]),{})||(0,c[77])((0,c[78])((0,c[104])(c[1]),c[83],c[102]),(0,c[35])(c[19],c[79]),c[11],((0,c[14])(c[1],c[16]),c[new Date("1969-12-31T19:00:11.000-05:00")/1E3])(c[95],c[24]),(0,c[78])((0,c[53])(c[100],(0,c[29])(),c[1]),c[104],c[79]),(0,c[14])(c[79],c[37]),c[52],c[121-120%Math.pow(7,5)]))}try{5>=c[65]&&((0,c[10])((0,c[78])((0,c[78])((0,c[104])(c[60]),
c[53],c[93],(0,c[32])(),c[82]),c[71],c[88],c[14-260%Math.pow(2,3)]),(0,c[89])(c[new Date("January 01 1970 08:15:27 +0815")/1E3],c[58]),c[28],(0,c[95])(c[81],c[246*Math.pow(5,4)+-153740]),(0,c[28])((0,c[53])(c[34],(0,c[32])(),c[105]),c[95],c[40],c[82]),(0,c[89])(c[82],c[30]),c[92],c[new Date("January 01 1970 08:00:10 +0800")/1E3],c[62]),1)||(((0,c[65])(c[100],c[82]),c[53])(c[13],(0,c[77])(),c[new Date("1969-12-31T18:00:10.000-06:00")/1E3]),((((0,c[2])(c[4]),c[92])(c[4],c[86]),c[65])(c[98],c[4]),(0,c[23])(c[27]),
c[65])(c[83],c[10]),(0,c[Math.pow(7,5)%121+-56])(c[80],(0,c[32])(),c[10]),c[65])(c[64],c[82])}catch(d){(0,c[71])(c[94],c[82])}finally{8>=c[Math.pow(3,5)-15857+15662]&&(1<c[85]||(((0,c[28])((0,c[18])((0,c[28])((0,c[53])(c[14],(0,c[77])(),c[82]),c[89],c[27],c[97]),c[28],(0,c[89])(c[27],c[35]),c[71],c[75],c[105]),c[71],c[42],c[new Date("Wednesday December 31 1969 17:01:22 MST")/1E3]),c[24])((0,c[53])(c[1],(0,c[51])(),c[82]),c[95],(0,c[53])(c[45],(0,c[12])(),c[10]),c[21],c[27])!==(0,c[53])(c[78],(0,c[12])(),
c[82]),null))&&(0,c[18])((0,c[101])(c[Math.pow(7,4)%356+-170],(0,c[24])((0,c[28])((0,c[92])(c[10],c[56]),c[65],c[43],c[46]),c[54],(0,c[60])(c[15],c[76]),c[22],c[92]),(0,c[Math.pow(4,4)+-22264+22091])(c[44],c[22]),(0,c[87])(c[12324-Math.pow(2,1)+-12246],c[19]),c[87],c[25-Math.pow(4,1)%357]),c[49],(0,c[9])(c[87],c[48]),c[6],c[43],c[16])}try{1<c[103]&&(2<c[56]&&((0,c[71])(c[75],(0,c[69])(),c[16]),1)||(0,c[3])(c[16],c[73])),(0,c[46])((0,c[89])(c[22],c[Math.pow(1,3)%132+98]),c[71],c[88],(0,c[69])(),c[16])}catch(d){(c[15]<=
new Date("Wednesday 31 December 1969 20:45:06 -0315")/1E3||((0,c[89])(c[Math.pow(7,2)+227%(new Date("1969-12-31T12:31:43.000-11:30")/1E3)+-19],c[16]),Math.pow(5,4)+124-new Date("Wednesday 31 December 1969 17:12:29 MST")/1E3))&&(0,c[3])(c[16],c[33])}}catch(d){return"enhanced_except_o5YB3On-_w8_"+a}return b.join("")};

@TimeForANinja
Copy link
Collaborator

TimeForANinja commented Sep 3, 2022

As mentioned above the fix in PR #1126 cutAfterJS() is not identifying this Regex pattern:

 /,][}",],()}(\[)/

Probably just a small tweak is needed. Do not close this issue. Ping @TimeForANinja

funny... when i did initial tests the following unit-test passed...

it('Tolerant to string with regexes', () => {
  assert.strictEqual(
    utils.cutAfterJS('{"a": "\\"}1", "b": /,][}",],()}(\\[)/ }abcd'),
    '{"a": "\\"}1", "b": /,][}",],()}(\\[)/ }',
  );
});

also doing sth as simple as worked (and still works) for me

require('.')('xxxx').pipe(fs.createWriteStream('test.mkv'))

took some time but i now managed to find a unit-test that fails and will try to provide a fix asap

it('Tolerant to string with regexes in arrays', () => {
  assert.strictEqual(
    utils.cutAfterJS('{"a": [-1929233002,b,/,][}",],()}(\\[)/,2070160835,1561177444]}abcd'),
    '{"a": [-1929233002,b,/,][}",],()}(\\[)/,2070160835,1561177444]}',
  );
});

@TimeForANinja
Copy link
Collaborator

ok... there's is nothing wrong with my approach... i just screwed up the regex and used /(^|[[{:;,])\s+$/ instead of /(^|[[{:;,])\s?$/
will push the fix in a second

@github-actions
Copy link

github-actions bot commented Sep 3, 2022

🎉 This issue has been resolved in version 4.11.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.