Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.

Crash if Array.prototype.whatever is defined #7

@Loda

Description

@Loda

if you define an extra function for array.

eg:

Array.prototype.contains = function(obj) {
    var i = this.length;
    while (i--) {
        if (this[i] === obj) {
            return true;
        }
    }
    return false;
};

the parser crash on line

/node_modules/yamlparser/yamlparser.js:412

.

function preProcess(src) {
    for(var i in lines) {
        if(m = lines[i].match(r)) {

function(obj) .... has no method "match"

Suggestion (not tested):

use

for (var i = 0 ; ...)

or add a test with

.hasOwnProperty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions