Bug 1811852 Comment 23 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

It looks like [`aInDevMode->dmDriverExtra` is either wrong or garbage here](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrintSettingsWin.cpp#235).

So, we need to be [checking that here](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrintSettingsWin.cpp#178).
Although I think we could safely set `dmDriverExtra` to zero and just copy the standard `DEVMODEW` data.

We do allocate [twice as much as it tells us](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrinterWin.cpp#327) for the `DEVMODEW`, because of similar code in chrome, but clearly if `dmDriverExtra` is garbage that's not going to help us here.

Hmm, I wonder if a driver is adding on to `dmDriverExtra` (and maybe `dmSize`) instead of setting it.
So, we should probably set the array held by `devmodeStorageWLock` to zeros before we call `::DocumentPropertiesW`.

It would be nice if I could reproduce with an specific driver.
Either way these would be sound changes.
It looks like [`aInDevMode->dmDriverExtra` is either wrong or garbage here](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrintSettingsWin.cpp#235).

So, we need to be [checking that here](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrintSettingsWin.cpp#178).
Although I think we could safely set `dmDriverExtra` to zero and just copy the standard `DEVMODEW` data.

We do allocate [twice as much as it tells us](https://searchfox.org/mozilla-central/rev/df68a65540f2227e27a12ed0b491188e2927f6d5/widget/windows/nsPrinterWin.cpp#327) for the `DEVMODEW`, because of similar code in chrome, but clearly if `dmDriverExtra` is garbage that's not going to help us here.

Hmm, I wonder if a driver is adding on to `dmDriverExtra` (and maybe `dmSize`) instead of setting it.
So, we should probably set the array held by `devmodeStorageWLock` to zeros before we call `::DocumentPropertiesW`.

It would be nice if I could reproduce with a specific driver.
Either way these would be sound changes.

Back to Bug 1811852 Comment 23