Closed
Bug 33193
Opened 25 years ago
Closed 24 years ago
libxpt needs sanity check for possible typelib truncation
Categories
(Core :: XPConnect, defect, P3)
Core
XPConnect
Tracking
()
VERIFIED
FIXED
mozilla0.9.6
People
(Reporter: jrgmorrison, Assigned: dbradley)
References
()
Details
(Whiteboard: patch review)
Attachments
(1 file, 4 obsolete files)
973 bytes,
patch
|
jst
:
review+
jband_mozilla
:
superreview+
|
Details | Diff | Splinter Review |
From bug #33183, where browser.xpt was truncated, resulting in a quick,
fatal crash of the browser on launch with an error message:
"FATAL: can't no room for 1 in cursor." ...
---- Additional Comments From shaver@mozilla.org 2000-03-24 10:22 -------
We should probably do some sanity checking to make sure that the file length
matches TypeLibHeader.file_length, so we can report a better error message.
I'll take a bug on that, but it won't get fixed before the party.
----
So, this would be that bug.
Comment 2•25 years ago
|
||
Changed the subject to reflect that the specific check we're talking about is
truncation of the typelib file. Passing in the file length to XPT_DoHeader for
verification when doing XPT_DECODE ought to do the trick.
Summary: Add some sanity checks to typelib loading → libxpt needs sanity check for possible typelib truncation
Updated•25 years ago
|
Status: NEW → ASSIGNED
Comment 3•24 years ago
|
||
This bug has not been touched for more than nine months. In most cases, that
means it has "slipped through the net". Please could the owner take a moment to
add a comment to the bug with current status, and/or close it.
Thank you :-)
Gerv
Comment 4•24 years ago
|
||
mass reassign of xpconnect bugs to dbradley@netscape.com
Assignee: jband → dbradley
Status: ASSIGNED → NEW
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Assignee | ||
Comment 5•24 years ago
|
||
From what I can tell the size entry in the header is not being set. So
additional logic needs to be added to set this value.
Comment 6•24 years ago
|
||
(If I understand you) I think it goes the other way. Once we are filling in the
header it is too late. As I said above, I think the XPT_DoHeader should get
a new param used in the decode case where the caller would pass in the size of
the file it read. XPT_DoHeader would take that into account. If that size were
smaller than sizeof(XPTHeader) it would *know* it was bogus. Otherwise, it would
xdr up to getting header->file_length and fail there if the sizes don't match.
Assignee | ||
Comment 7•24 years ago
|
||
Right, you need a check before the attempt to read the header. It's the
subsequent check of file_length after you read the header that I was refering to
that has a problem. file_length in XPTHeader is always zero.
Comment 8•24 years ago
|
||
Right, sorry for being dense. I didn't realize that we weren't evven writing the
length into the file. so we're not conforming to the typelib spec in this
regard. Hmm, that doesn't look so easy to fix. Perhaps that deserves its own
bug. Further, it may just not be worth the effort to finx anytime soon.
Assignee | ||
Updated•24 years ago
|
QA Contact: rginda → pschwartau
Assignee | ||
Comment 9•24 years ago
|
||
I had already fixed the length bug and had started on adding the logic to check.
So I figured I'd go ahead and complete it.
There were three conditions I tested for.
1. Zero length XPT file.
2. XPT file with a length less than the header
3. XPT file with a length more than the header but less than the stated size in
the header.
I moved the code that writes the initial part of the header into a separate
function. This allows me to call it from within the XPT_DoHeader to do the
normal stuff and outside of the function to rewrite the header part with the
size. This, admittedly, is not an optimal solution, but it has the least impact
to the overall existing structures and interface. I then fixed up xpt_link.c,
and xpt_typelib.c to rewrite the header with the proper size.
Assignee | ||
Comment 10•24 years ago
|
||
Comment 11•24 years ago
|
||
David: It would be good if you update this bug with just the parts that are not
in the patch to bug 83501 (not to rush you, of course!).
Also, (in case you did not think of it), you are going to have to add special
case logic to 'trust' xpt files that do not have any filelength info. We don't
want to break compatibility with deployed xpt files if we don't have to.
Assignee | ||
Comment 12•24 years ago
|
||
Yes I was going to do that. The problem I ran into is how to create this patch.
If I diff against the tip it won't be correct when it's applied after the patch
to 83591. I figured the patches would invalidate themselves since they both
involve changes in the same area. I didn't know of a way to diff just local
files and get the same format as cvs diff. So I was figuring on checking in the
patch for 83591 and then diffing. I did some playing and diff does seem to
generate a format that patch will use, although it's not identical to 83591.
I'll attach that.
Also, does this patch really need to wait? It still is a bit more risky than
83591, but with the allowance of xpt files with zero length, it's not as risk as
originally written.
Assignee | ||
Comment 13•24 years ago
|
||
Assignee | ||
Comment 14•24 years ago
|
||
Comment 15•24 years ago
|
||
Are you still waiting for review on this one?
Have you been running with it in your build?
I wonder if it shouldn't check '!=' rather than '<'. I suppose it is *far* less
likely to see a file with garbage inserted in the middle than simply a truncated
file. So, that would make little difference.
Assignee | ||
Updated•24 years ago
|
Attachment #37377 -
Attachment is obsolete: true
Assignee | ||
Updated•24 years ago
|
Attachment #46061 -
Attachment is obsolete: true
Assignee | ||
Updated•24 years ago
|
Attachment #46062 -
Attachment is obsolete: true
Assignee | ||
Comment 16•24 years ago
|
||
Assignee | ||
Comment 17•24 years ago
|
||
I used the < rather than != because the value tested is the memory pool size.
Ideally and in practice this is the size reported in header, but given the
concept I didn't feel safe using !=. Maybe I'm too paranoid.
Target Milestone: Future → mozilla0.9.6
Assignee | ||
Comment 18•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Attachment #55718 -
Flags: review+
Assignee | ||
Updated•24 years ago
|
Attachment #55718 -
Attachment is obsolete: true
Attachment #55718 -
Flags: review+
Comment 19•24 years ago
|
||
Comment on attachment 55720 [details] [diff] [review]
Fixed mispelling, and add info to error message
r=jst
Attachment #55720 -
Flags: review+
Comment 20•24 years ago
|
||
Comment on attachment 55720 [details] [diff] [review]
Fixed mispelling, and add info to error message
sr=jband
Attachment #55720 -
Flags: superreview+
Assignee | ||
Comment 21•24 years ago
|
||
Forgot to mark fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 23•24 years ago
|
||
patch checked in
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•