If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

nsPromiseFlat[C]String(Substring(...)) broken

RESOLVED FIXED in mozilla0.9

Status

()

Core
String
P3
major
RESOLVED FIXED
17 years ago
17 years ago

People

(Reporter: Chris Waterson, Assigned: Scott Collins)

Tracking

Trunk
mozilla0.9
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

17 years ago
You cannot create a correct nsPromiseFlatString on a Substring. Specifically,
nsPromiseFlatString does not detect the case where the Substring does not end at
the right-most character of the "parent" string. Here's a simple example:

  const nsAReadableCString& hereIsSomeText
    = NS_LITERAL_CSTRING("here is some text");
  const nsAReadableCString& some
    = Substring(hereIsSomeText, 8, 4);

  printf("%s\n", nsPromiseFlatCString(some).get());

Expected output:
  some

Actual output:
  some text
(Reporter)

Updated

17 years ago
Blocks: 53627
(Reporter)

Comment 1

17 years ago
cc'ing vidur, who worked on nsPromiseFlatString...
(Assignee)

Updated

17 years ago
Status: NEW → ASSIGNED
Need this for RTM?

/be
(Assignee)

Comment 3

17 years ago
promise-flat needs some work ... needs to know about non-zero terminated cases, etc.
Target Milestone: --- → mozilla0.9
(Assignee)

Updated

17 years ago
Component: XPCOM → String
(Assignee)

Updated

17 years ago
Depends on: 70090
(Assignee)

Updated

17 years ago
No longer depends on: 70090
(Assignee)

Updated

17 years ago
Blocks: 70090
(Assignee)

Updated

17 years ago
Target Milestone: mozilla0.9 → mozilla0.8.1
(Assignee)

Comment 4

17 years ago
(mass change) didn't get these in for target milestone mozilla0.8.1 but they are
very close.  Moving all to mozilla0.9.
Target Milestone: mozilla0.8.1 → mozilla0.9
(Reporter)

Comment 5

17 years ago
Hey scc, when are you going to fix this?
(Assignee)

Updated

17 years ago
Blocks: 73786
(Assignee)

Comment 6

17 years ago
So this is fixed at the cost of always copying substrings even when that is
_not_ required.  I'm going to do more work on substrings to prevent this. 
Basically, they have to advertise themselves as flat at the appropriate time. 
Currently, they never do.  Marking this bug fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.