Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions javascript/ql/test/library-tests/TripleDot/web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
function Websock() {
"use strict";
this._websocket = null;
this._rQi = 0;
this._rQlen = 0;
};

(function () {
"use strict";
var typedArrayToString = (function () {return function (a) { return String.fromCharCode.apply(null, a); };})();

Websock.prototype = {
rQshiftStr: function (len) {
var arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
this._rQi += len;
var str = typedArrayToString(arr);
sink(str); // $ MISSING: hasTaintFlow=h1.2
return str;
},

decode_message: function (data) {
var u8 = new Uint8Array(data);
this._rQ.set(u8, this._rQlen);
this._rQlen += u8.length;
},

recv_message: function (e) {
e = source("h1.2");
this.decode_message(e.data);
}
};
})();



class Websock {
constructor() {
this._websocket = null;
this._rQi = 0;
this._rQlen = 0;
this._rQbufferSize = 1024 * 1024 * 4;
this._rQ = new Uint8Array(this._rQbufferSize);
}

static typedArrayToString(arr) { return String.fromCharCode.apply(null, arr);}

rQshiftStr(len = this._rQlen) {
const arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
this._rQi += len;
let str = Websock.typedArrayToString(arr);
sink(str); // $ hasTaintFlow=h1.1
return str;
}

decode_message(data) {
const u8 = new Uint8Array(data);
this._rQ.set(u8, this._rQlen);
this._rQlen += u8.length;
}

recv_message(e) {
e = source("h1.1");
this.decode_message(e.data);
}
}
Loading