Closed Bug 368859 Opened 18 years ago Closed 17 years ago

large sharp variable numbers are silently rounded down

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: sync2d, Assigned: sync2d)

Details

(Keywords: verified1.8.0.12, verified1.8.1.4)

Attachments

(1 file, 1 obsolete file)

Attached patch use the appropriate limit (obsolete) — Splinter Review
Without the patch:

$ dbg.obj/js -e "print(function(){ return #65535#, #65536#; });"
function () {
    return #65535#, #0#;
}

With the patch:

$ dbg.obj/js -e "print(function(){ return #65535#, #65536#; });"
-e:1: SyntaxError: overlarge sharp variable number:
-e:1: print(function(){ return #65535#, #65536#; });
-e:1: ..................................^
Attachment #253494 - Flags: review?(brendan)
Comment on attachment 253494 [details] [diff] [review]
use the appropriate limit

Yikes! Why'd I couple to the wrong limit (no atom index [JOF_CONST format] ops for sharp var numbers, they're 16-bit [JOF_UINT16]).

Thanks for patching this, I will check it in now.

/be
Attachment #253494 - Flags: review?(brendan)
Attachment #253494 - Flags: review+
Attachment #253494 - Flags: approval1.8.1.3?
Attachment #253494 - Flags: approval1.8.0.11?
Safe rider for patch releases.

js/src/jsscan.c 3.119

Patch I landed in a sec, for posterity.

/be
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Pedantic, but I figured it might help future opcode format readers and revisers.

/be
Comment on attachment 255286 [details] [diff] [review]
use UINT16_LIMIT from jsopcode.h

This is the one that should ride along.

/be
Attachment #255286 - Flags: review+
Attachment #255286 - Flags: approval1.8.1.3?
Attachment #255286 - Flags: approval1.8.0.11?
Attachment #253494 - Attachment is obsolete: true
Attachment #253494 - Flags: review+
Attachment #253494 - Flags: approval1.8.1.3?
Attachment #253494 - Flags: approval1.8.0.11?
/cvsroot/mozilla/js/tests/js1_5/extensions/regress-368859.js,v  <--  regress-368859.js
Flags: in-testsuite+
verified fixed 20070217 1.9.0 windows/mac*/linux
Status: RESOLVED → VERIFIED
Comment on attachment 255286 [details] [diff] [review]
use UINT16_LIMIT from jsopcode.h

approved for 1.8/1.8.0 branches, a=dveditz for drivers
Attachment #255286 - Flags: approval1.8.1.4?
Attachment #255286 - Flags: approval1.8.1.4+
Attachment #255286 - Flags: approval1.8.0.12?
Attachment #255286 - Flags: approval1.8.0.12+
Whiteboard: needs branch landing
Whiteboard: needs branch landing → needs branch landing (brendan did trunk)
Landed on branches:

1.8   - jsscan.c: 3.81.2.28
1.8.0 - jsscan.c: 3.81.2.7.2.10
For 1.8.0, we don't have the UINT16_LIMIT define, so I am just using ((uintN)1 << 16) directly.

jsscan.c: 3.81.2.7.2.11
verified fixed windows, macppc, linux 1.8.0, 1.8.1 20070420 shell.
Whiteboard: needs branch landing (brendan did trunk)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: