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

content script in gmail: RangeError: Invalid string length #756

Closed
tomholub opened this issue May 3, 2017 · 2 comments
Closed

content script in gmail: RangeError: Invalid string length #756

tomholub opened this issue May 3, 2017 · 2 comments
Assignees
Milestone

Comments

@tomholub
Copy link
Collaborator

tomholub commented May 3, 2017

RangeError: Invalid string length
    at replace_armored_block_type (/js/common/common.js:1515:67)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)
    at replace_armored_block_type (/js/common/common.js:1516:12)

Somewhere here:

  function replace_armored_block_type(text, block_headers, end_required, block_processor, optional_search_after_index) {
    var begin_index = text.indexOf(block_headers.begin, optional_search_after_index);
    if(begin_index < 0) {
      return text;
    }
    var end_found = -1;
    var end_len = 0;
    if(typeof block_headers.end.exec === 'undefined') { // end defined by string
      end_found = text.indexOf(block_headers.end, begin_index);
      end_len = block_headers.end.length;
    } else {
      var regex_end_found = block_headers.end.exec(text);
      if(regex_end_found) {
        end_found = regex_end_found.index;
        end_len = regex_end_found[0].length;
      }
    }
    var end_index;
    if(end_found < 0) {
      if(end_required) {
        return text;
      } else {
        end_index = text.length - 1; // end not found + not required, get everything (happens for long clipped messages)
      }
    } else {
      end_index = end_found + end_len;
    }
    var block_replacement = '\n' + block_processor(text.substring(begin_index, end_index), end_found > 0) + '\n';
    var text_with_replaced_block = text.substring(0, begin_index) + block_replacement + text.substring(end_index, text.length);
    return replace_armored_block_type(text_with_replaced_block, block_headers, end_required, block_processor, begin_index + block_replacement.length);
  }
@tomholub tomholub added this to the 4.0.3: Subscriptions milestone May 3, 2017
@tomholub tomholub self-assigned this May 3, 2017
@tomholub tomholub modified the milestones: 4.0.3: Subscriptions, Ideas L1 May 3, 2017
@tomholub tomholub modified the milestones: Ideas L1, 4.1.2 Jun 5, 2017
@tomholub
Copy link
Collaborator Author

tomholub commented Jun 5, 2017

String too big nodejs/node-v0.x-archive#14170

@tomholub tomholub modified the milestones: Ideas L3, 4.1.2 Jun 5, 2017
@tomholub
Copy link
Collaborator Author

tomholub commented Feb 8, 2019

horribly dated

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

No branches or pull requests

1 participant