Crash [@ fastcopy_I ] - printing broken

VERIFIED FIXED

Status

()

Core
Widget: Win32
--
critical
VERIFIED FIXED
9 years ago
7 years ago

People

(Reporter: John, Assigned: blassey)

Tracking

({crash, regression, verified1.9.1})

Trunk
x86
Windows XP
crash, regression, verified1.9.1
Points:
---
Bug Flags:
blocking1.9.1 +

Firefox Tracking Flags

(Not tracked)

Details

(crash signature)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081022 Minefield/3.1b2pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081022 Minefield/3.1b2pre

Browser crashes when pressing the OK button on the print dialog when printing to a PDF. I did not try to print to a regular printer at this time

Crash Report: http://crash-stats.mozilla.com/report/index/92294657-a085-11dd-bfe1-001a4bd43ef6

Reproducible: Always

Steps to Reproduce:
1. Visit http://www.fairfieldmirror.com/news/university_college_refuses_to_comment_on_cheating
2.Press the print button on the webpage (top right side of the article above the picture)
3. The print dialog will appear. Press OK
4. 
Actual Results:  
Browser crashes

Expected Results:  
The page should print
bp-5bd697c2-a0b7-11dd-804a-001321b13766 (Minefield/3.1b2pre ID:20081022033543)
bp-c6b79528-a0b7-11dd-86eb-001321b13766 (Minefield/3.1b2pre ID:20081022033543)

Signature	fastcopy_I
UUID	5bd697c2-a0b7-11dd-804a-001321b13766
Time	2008-10-22 21:00:28-07
Uptime	224
Product	Firefox
Version	3.1b2pre
Build ID	20081022033543
OS	Windows NT
OS Version	5.1.2600 Service Pack 3
CPU	x86
CPU Info	GenuineIntel family 15 model 2 stepping 9
Crash Reason	EXCEPTION_ACCESS_VIOLATION
Crash Address	0x1d67000
Comments	

Frame 	Module 	Signature 	Source
0 	mozcrt19.dll 	fastcopy_I 	
1 	mozcrt19.dll 	_VEC_memcpy 	
2 	mozcrt19.dll 	_VEC_memcpy 	
3 	xul.dll 	nsPrintSettingsWin::CopyDevMode(_devicemodeW*,_devicemodeW*&) 	widget/src/windows/nsPrintSettingsWin.cpp:118
4 	xul.dll 	nsPrintSettingsWin::SetDevMode(_devicemodeW*) 	widget/src/windows/nsPrintSettingsWin.cpp:144
5 	kernel32.dll 	kernel32.dll@0xff11

this is not limited to pdf printing, but trying to print to any installed printer in windows. if you just get the "an unknown error has occurred" message try again the printing steps and the crash will happen.

from http://forums.mozillazine.org/viewtopic.php?p=4798625#p4798625 the regrange is:
20081021182718 works
20081021185233 fails

by this and the stacktrace i presume this is because of Bug 460979 => CCing Joshua for comment.
Blocks: 460979
Status: UNCONFIRMED → NEW
Component: General → GFX: Gtk
Ever confirmed: true
Keywords: crash
Product: Firefox → Core
QA Contact: general → gtk
Summary: Crash [@ fastcopy_I ] → Crash [@ fastcopy_I ] - printing broken
Version: unspecified → Trunk
Bug 344111 affected only Linux (GTK+) code, so there's no way it could be causing a crash on Windows. Try again. :)
No longer blocks: 460979
(In reply to comment #2)
> Bug 344111 affected only Linux (GTK+) code, so there's no way it could be
> causing a crash on Windows. Try again. :)

Uh, not sure how I came up with that bug number, but I meant bug 460979.
Component: GFX: Gtk → Widget: Win32
QA Contact: gtk → win32
arrg, you're right. but then only http://hg.mozilla.org/mozilla-central/rev/0b9819e66ace (Bug 459674, which made changes in that timeframe to nsPrintSettingsWin.cpp) remains by my wild guessing :-).
(Reporter)

Updated

9 years ago
Flags: blocking1.9.1?
the crash is happening in the memcpy here:
http://mxr.mozilla.org/mozilla-central/source/widget/src/windows/nsPrintSettingsWin.cpp#118

I assume size is wrong
(Reporter)

Updated

9 years ago
Created attachment 344589 [details] [diff] [review]
switches from DEVMODE and PRINTDLG to DEVMODEW and PRINTDLGW

This fixes the crash for me.
Assignee: nobody → blassey
Status: NEW → ASSIGNED
Attachment #344589 - Flags: review?
(Assignee)

Updated

9 years ago
Attachment #344589 - Flags: review? → review?(pavlov)
Comment on attachment 344589 [details] [diff] [review]
switches from DEVMODE and PRINTDLG to DEVMODEW and PRINTDLGW


>@@ -897,20 +894,19 @@
>   if (!printerName) return NS_ERROR_FAILURE;
> 
>   // Now create a DEVNAMES struct so the the dialog is initialized correctly.
>-  nsCAutoString tempPrinterName;
>-  rv = NS_CopyUnicodeToNative(nsDependentString(printerName), tempPrinterName);
>-  NS_ENSURE_SUCCESS(rv, rv);
>+  nsAutoString tempPrinterName(printerName);
> 
>   PRUint32 len = tempPrinterName.Length();
>-  hDevNames = (HGLOBAL)::GlobalAlloc(GHND, len+sizeof(DEVNAMES)+1);
>+  hDevNames = (HGLOBAL)::GlobalAlloc(GHND, sizeof(wchar_t) * (len + 1) + 
>+                                     sizeof(DEVNAMES));
>   DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames);
>   pDevNames->wDriverOffset = sizeof(DEVNAMES);
>   pDevNames->wDeviceOffset = sizeof(DEVNAMES);
>   pDevNames->wOutputOffset = sizeof(DEVNAMES)+len+1;
>   pDevNames->wDefault      = 0;
> 
>-  char* device = &(((char*)pDevNames)[pDevNames->wDeviceOffset]);
>-  strcpy(device, tempPrinterName.get());
>+  wchar_t* device = &(((wchar_t*)pDevNames)[pDevNames->wDeviceOffset]);
>+  wcscpy(device, tempPrinterName.get());
>   ::GlobalUnlock(hDevNames);
> 


I don't think you need the tempPrinterName temporary any more -- you should be able to just use printerName, no?  I don't know what type printerName is.  r+ either way.
Attachment #344589 - Flags: review?(pavlov) → review+
Created attachment 344592 [details] [diff] [review]
removed tempPrinterName

carrying vlad's r+
Attachment #344589 - Attachment is obsolete: true
Attachment #344592 - Flags: review+
changeset:   20801:95f09bc4d690
tag:         tip
user:        Brad Lassey <blassey@mozilla.com>
date:        Fri Oct 24 01:21:15 2008 -0400
summary:     Bug 461283 -  Crash [@ fastcopy_I ] - printing broken r=vlad
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED

Updated

9 years ago
Duplicate of this bug: 461424

Comment 11

9 years ago
Is this bug back again or are these reports caused by something else?

http://crash-stats.mozilla.com/report/list?range_value=2&range_unit=weeks&version=Firefox%3A3.1b2pre&signature=fastcopy_I

Comment 12

9 years ago
No, printing works fine here.

Comment 13

9 years ago
(In reply to comment #11)
> Is this bug back again or are these reports caused by something else?
> 
> http://crash-stats.mozilla.com/report/list?range_value=2&range_unit=weeks&version=Firefox%3A3.1b2pre&signature=fastcopy_I

Whatever it was it has been solved in 20081114 nightly.
Sorry for the bugspam.
Flags: blocking1.9.1? → blocking1.9.1+
Status: RESOLVED → VERIFIED
Crash Signature: [@ fastcopy_I ]
You need to log in before you can comment on or make changes to this bug.