Application crashes in FillBins procedure

edited 6:24PM in FastReport 4.0
Hi,

we use FastReport 4.7.154 in our application and currently came across a problem when printing on certain Minolta printers (2530DL and 2480MF with czech version of their printer driver). When I try to print on such a printer, our application just exits without any message. I tried to trace the problem, and it turned out that the reason is in procedure FillBins in frxPrinter unit, concretely in call of function DeviceCapabitilies, which should read bin names. FastReport reserves 24 bytes for every bin name, that is correct according to windows documentation. But in case of the mentioned printer drivers the function call overwrites more bytes, which results in unpredictable results and (in out case) in subsequent application crash.
I suppose the reason originated when Minolta localized the driver into czech language - they probably forgot to keep the 24 byte limit and windows seem to pass as many bytes as the driver wishes, which results in buffer overflow. While I see that the primary problem in this case lies in the printer driver, i propose to modify the FillBins procedure and reserve more bytes at the end of the buffer to prevent such problems (double size should be sufficient). Minolta printers are quite common here and people use the driver in other applications without problems. If you want to test it, you can download and install Minolta 2530DL software from http://printer.konicaminolta.eu/ (czech edition for Windows XP - file mc2530_W2k_xp_czech.zip), you may set it to print to file so that you don't have to own the printer.

Regards,
Michal

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.