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

RangeError: Invalid count value exception in idn() #1559

Closed
Orphis opened this Issue Mar 6, 2018 · 9 comments

Comments

Projects
None yet
5 participants
@Orphis

Orphis commented Mar 6, 2018

When rendering the webrtc-pc spec, we get this exception:

respec-w3c-common.js:1 RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at M (respec-w3c-common.js:414)
    at Object.<anonymous> (respec-w3c-common.js:414)
    at Object.main (respec-w3c-common.js:1)
    at c (respec-w3c-common.js:1)
    at i (respec-w3c-common.js:1)
    at respec-w3c-common.js:414
    at respec-w3c-common.js:414
    at Array.map (<anonymous>)
    at Q (respec-w3c-common.js:414)

I tracked it down to idn() calls with a negative number. Not quite sure why, but it shouldn't throw any exception. Adding a Math.max(0, lvl) to idn() seems to fix the issue, but I didn't try to see why it would have a negative padding in the first place.

@marcoscaceres

This comment has been minimized.

Show comment
Hide comment
@marcoscaceres

marcoscaceres Mar 8, 2018

Member

Confirmed. Looks like a regression, maybe related to recent IDL changes.

Member

marcoscaceres commented Mar 8, 2018

Confirmed. Looks like a regression, maybe related to recent IDL changes.

@sidvishnoi

This comment has been minimized.

Show comment
Hide comment
@sidvishnoi

sidvishnoi Mar 9, 2018

Collaborator

I've tracked down the bug to
src/core/webidl.js#L676:L677 --- if (meth.static) len += 7; and
src/core/webidl.js#L693 --- var pad = max - len;.

What is this 7?
What should be done? Should we increase max by 7 also? or make pad = Math.max(pad,0)

Collaborator

sidvishnoi commented Mar 9, 2018

I've tracked down the bug to
src/core/webidl.js#L676:L677 --- if (meth.static) len += 7; and
src/core/webidl.js#L693 --- var pad = max - len;.

What is this 7?
What should be done? Should we increase max by 7 also? or make pad = Math.max(pad,0)

@saschanaz

This comment has been minimized.

Show comment
Hide comment
@saschanaz

saschanaz Mar 10, 2018

Collaborator

What is this 7?

"static ".length === 7.

Currently the webidl module is slightly a mess... Anyway, the right fix is to do the same += 7 in line 594.

respec/src/core/webidl.js

Lines 588 to 595 in 23001a6

var len = idlType2Text(it.idlType).length;
if (it.type === "attribute") {
var qualifiersLen = writeAttributeQualifiers(it).length;
maxAttr = len > maxAttr ? len : maxAttr;
maxAttrQualifiers =
qualifiersLen > maxAttrQualifiers ? qualifiersLen : maxAttrQualifiers;
} else if (it.type === "operation") maxMeth = len > maxMeth ? len : maxMeth;
else if (it.type === "const") maxConst = len > maxConst ? len : maxConst;

Collaborator

saschanaz commented Mar 10, 2018

What is this 7?

"static ".length === 7.

Currently the webidl module is slightly a mess... Anyway, the right fix is to do the same += 7 in line 594.

respec/src/core/webidl.js

Lines 588 to 595 in 23001a6

var len = idlType2Text(it.idlType).length;
if (it.type === "attribute") {
var qualifiersLen = writeAttributeQualifiers(it).length;
maxAttr = len > maxAttr ? len : maxAttr;
maxAttrQualifiers =
qualifiersLen > maxAttrQualifiers ? qualifiersLen : maxAttrQualifiers;
} else if (it.type === "operation") maxMeth = len > maxMeth ? len : maxMeth;
else if (it.type === "const") maxConst = len > maxConst ? len : maxConst;

@saschanaz

This comment has been minimized.

Show comment
Hide comment
@saschanaz

saschanaz Mar 10, 2018

Collaborator

@marcoscaceres, do we want to keep this formatter-like feature after we do w3c/webidl2.js#125?

Collaborator

saschanaz commented Mar 10, 2018

@marcoscaceres, do we want to keep this formatter-like feature after we do w3c/webidl2.js#125?

@marcoscaceres

This comment has been minimized.

Show comment
Hide comment
@marcoscaceres

marcoscaceres Mar 10, 2018

Member

No, I’d like to get rid of the formatter in ReSpec.

Member

marcoscaceres commented Mar 10, 2018

No, I’d like to get rid of the formatter in ReSpec.

marcoscaceres added a commit that referenced this issue Mar 10, 2018

marcoscaceres added a commit that referenced this issue Mar 10, 2018

marcoscaceres added a commit that referenced this issue Mar 10, 2018

marcoscaceres added a commit that referenced this issue Mar 10, 2018

Merge branch 'develop' into gh-pages
* develop:
  v20.0.4
  test(webidl-spec): stringifier as operation
  tests(core/webidl-spec): output static method
  refactor(method.html): treat static as 'special'
  fix(core/webidl): pad static methods * closes #1559
  refactor(core/issues-notes): use async/await + simplify (#1560)
  style(core/webidl): prettier
  chore(package): update deps (#1564)
  fix: link back to top to title of spec (#1550)
  refactor(core/seo): merged seo and jsonld modules (#1556)
  fix(tests/headless): WebAudio now BS file
  style(structure-spec): prettier
  chore(package): add prettier config option
  Create CONTRIBUTING.md
  chore(package): build, then start server (#1558)
  refactor(w3c/informative): remove jQuery (#1553)
  refactor(core/inlines): use ES2015+/remove jQuery (#1549)
  chore(package-lock): regenerate
  chore(package): update clipboard to version 2.0.0 (#1542)
  style(core/issues-notes): run prettier over code
@marcoscaceres

This comment has been minimized.

Show comment
Hide comment
@marcoscaceres

marcoscaceres Mar 10, 2018

Member

@Orphis, should be good now, but you need to update ReSpec in the Web RTC repo.

Member

marcoscaceres commented Mar 10, 2018

@Orphis, should be good now, but you need to update ReSpec in the Web RTC repo.

@marcoscaceres

This comment has been minimized.

Show comment
Hide comment
@marcoscaceres

marcoscaceres Mar 10, 2018

Member

fixed typo above.

Member

marcoscaceres commented Mar 10, 2018

fixed typo above.

@Orphis

This comment has been minimized.

Show comment
Hide comment
@Orphis

Orphis commented Mar 10, 2018

Thanks!

@alvestrand

This comment has been minimized.

Show comment
Hide comment
@alvestrand

alvestrand Mar 12, 2018

@vivienlacourba can you take care of updating webrtc-pc and friends?

alvestrand commented Mar 12, 2018

@vivienlacourba can you take care of updating webrtc-pc and friends?

vivienlacourba added a commit to w3c/webrtc-pc that referenced this issue Mar 12, 2018

@marcoscaceres marcoscaceres reopened this Apr 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment