Closed Bug 55143 Opened 24 years ago Closed 23 years ago

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

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9

People

(Reporter: waterson, Assigned: scc)

References

Details

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
Blocks: 53627
cc'ing vidur, who worked on nsPromiseFlatString...
Status: NEW → ASSIGNED
Need this for RTM?

/be
promise-flat needs some work ... needs to know about non-zero terminated cases, etc.
Target Milestone: --- → mozilla0.9
Component: XPCOM → String
Depends on: 70090
No longer depends on: 70090
Blocks: 70090
Target Milestone: mozilla0.9 → mozilla0.8.1
(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
Hey scc, when are you going to fix this?
Blocks: 73786
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
Closed: 23 years ago
Resolution: --- → FIXED
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.