Closed Bug 66999 Opened 24 years ago Closed 24 years ago

Crash printing document with no title

Categories

(Core :: Printing: Output, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: ian, Assigned: dcone)

References

()

Details

Attachments

(1 file)

mozilla/layout/base/src/nsDocumentViewer.cpp around line 1497 does:

        // get the document title
        const nsString* docTitle = mDocument->GetDocumentTitle();
        PRUnichar * docStr = docTitle->ToNewUnicode();
        printService->SetTitle(docStr);
        nsMemory::Free(docStr);

This crashes if mDocument->GetDocumentTitle() returns NULL, as it does when
printing a picture (or probably an XML file, untested).

This requires at least a null pointer check.

STEPS TO REPRODUCE
   1. Go to an image, for example:
 http://www.dilbert.com/comics/dilbert/archive/images/dilbert20010121044118.gif
   2. Print.

ACTUAL RESULTS
   1. Laugh at picture.
   2. Cry at crash.

EXPECTED RESULTS
   1. Laugh at picture.
   2. Collect printout and stick it to your cube wall.
   3. Watch other people laugh at picture.

This bug was introduced by Rod's recent checkin, so assigning direct to him.
reassigning to dcone he has a fix in his tree for this, I have already checked 
in the fix on the embed branch for this
Assignee: rods → dcone
Fixed
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verified in 2/26 build.
Status: RESOLVED → VERIFIED
The fix for this bug corrects the crash, but introduces other behaviour which is
not ideal. Specifically, there are bugs 80799 and 81848 which are mis-listed as
duplicates of  71976 but aren't... With this fix, a document with no title will
print with the title of the previous printed page.
The correct fix for this is actually the fix for 71976, which gets rid of the
unprotected check of the title pointer.
To fix the stale title, I propose one of two patches. Either allow the title to
be null in the print properties, or set it to the empty string if it is null...
I am testing patches as I type this...
Should I enter this as a new bug, or is one of the bugs mentioned here more
appropriate?
I filed a new bug for this, Bug: 86558 and included my patch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: