Fix literalPacket.getText()

We now close streams after reading them, so we can no longer use
stream.locked for a proxy for "has been read". What we want is the
internal [[disturbed]] property, but we can't access it for native
streams.

Since we always read the stream when calling getText(), it's not
an issue.
This commit is contained in:
Daniel Huigens 2018-06-14 14:54:59 +02:00
parent 411b626149
commit e1a8b17753
2 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,7 @@ Literal.prototype.setText = function(text, format='utf8') {
* @returns {String} literal data as text
*/
Literal.prototype.getText = function(clone=false) {
if (this.text === null || this.text.locked) {
if (this.text === null || util.isStream(this.text)) { // Assume that this.text has been read
let lastChar = '';
const decoder = new TextDecoder('utf8');
// eslint-disable-next-line no-inner-declarations

View File

@ -710,6 +710,7 @@ Signature.prototype.verify = async function (key, data) {
const endian = publicKeyAlgorithm === enums.publicKey.eddsa ? 'le' : 'be';
const mpi = [];
let i = 0;
this.signature = await stream.readToEnd(this.signature);
for (let j = 0; j < mpicount; j++) {
mpi[j] = new type_mpi();
i += mpi[j].read(this.signature.subarray(i, this.signature.length), endian);