bugbananapos - Bugs: bug #7615, Apparent memory corruption in...

 
 

bug #7615: Apparent memory corruption in options (reopen)

Submitted by:  Rick Richard <rrichard>
Submitted on:  Sat 07 Feb 2004 09:29:26 AM UTC  
 
Category: ServerSeverity: 9 - Critical
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Rick Richard <rrichard>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 14 Feb 2004 05:53:03 AM UTC, comment #5:

As if anybody reads this but me...

This issue has now been resolved and the code has been committed to CVS. The affected files were inq.cpp and plusd.cpp under bhpos/plus/src

All printer message sizes were not being set correctly. The size of a BhPrinterMsg struct was supposed to be factored into the message size, but instead the sizeof of a pointer to a struct was being factored in. This prevented the last few bytes of global printer options from making it to the client and in their stead the client pointed to trash left in the message buffer (usually some bits from the preprint option). For the first time in about a year, my printer doesn't print garbage when I customize the print strings!

Rick Richard <rrichard>
Project MemberIn charge of this item.
Sat 14 Feb 2004 02:16:26 AM UTC, comment #4:

Another update...
After hours of pouring through code and debugging by writing to binary files, I have determined that the bug is in plusd relating to it sending out data packets to the client.

Plusd seems to be sending some data a little short (such as the global print footer option). Post then grabs a 1040 byte chunk of uninitialized data. The result is the random shit showing up in my binary print log =)

So, in summary the size of the message being sent by plusd is not being calculated correctly, or msg.hdr.size is not being set correctly. I hope to finish debugging and get a fix out for this issue tonight, but failing that I've at least documented it here.

Rick Richard <rrichard>
Project MemberIn charge of this item.
Mon 09 Feb 2004 11:19:55 PM UTC, comment #3:

An update... in plusd.cpp I noticed the following error: case BH_PLUS_OPTION_PRNFOOTER:
if(globalprint.footer) delete globalprint.footer;
globalprint.footer_size=strlen((char *) v) + 1;
globalprint.footer = new char[globalprint.footer_size];
if(globalprint.footer) globalprint.paysum_size=ParseString((char *) v, globalprint.footer);
break;

Note that the above couple lines should read globalprint.footer_size instead of paysum_size.

I have corrected this on my dev system but further testing reveals that there may yet be more problems.

Rick Richard <rrichard>
Project MemberIn charge of this item.
Mon 09 Feb 2004 10:07:47 AM UTC, comment #2:

After more debugging I've changed my mind (or maybe I'm just becoming a woman). At any rate:

I logged all the raw data sent to the printer to a file, as well as the len argument passed to the ::Output function in cprinter.cpp (clientlibs/src/printer/cprinter.cpp).

What I found is that the length passed for the global printer option footer is entirely too long (this is the source of my garbage, methinks...) Not only that, but there appears to be a bit of random rearrangement going on with the data in the address option. I noticed some NULLs being inserted between some text and some EPOS codes. The data being sent to the printer definately doesn't match what's in the plusd config file!

Rick Richard <rrichard>
Project MemberIn charge of this item.
Sat 07 Feb 2004 11:02:23 AM UTC, comment #1:

OK, upon further debugging it appears that the garbage at the head of each receipt comes from the postprint string of the previous reciept. More specifically, the printer doesn't like one of the final escape sequences it receives and it screws up the next receipt. Not a bug in bhpos after all, but a change I need to make in the printer config for my printer...

Rick Richard <rrichard>
Project MemberIn charge of this item.
Sat 07 Feb 2004 09:29:26 AM UTC, original submission:

OK, I noticed this a while back and I'm still seeing it in v1.2.0. When I customize store details for the printer (name, address, phone number) in plusd.conf, the printer spits out random garbage.

At the moment, preprint is printing out random bits and pieces before it prints. I'll include my global printer config as an example:

[globalprinter]
setup=
init= 0x27 0x64~
preprint= 0x27 0x97 0x01 "El Jacalito Musical" 0x10 "1565 Stowell Center Plaza" 0x10 "Santa Maria, CA 93458" 0x10 "(805)xxx-xxxx" 0x
10 0x10 0x27 0x97 0x00 0x27 0x77 0x01~
header =
item=
transsum=
paysum=
footer= 0x27 0x77 0x00 0x27 0x97 0x01 0x10 0x10~
postprint= 0x27 0x105 0x10 0x10 0x10~

Rick Richard <rrichard>
Project MemberIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 12 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 14 Feb 2004 05:53:03 AM UTCrrichardCategoryNone=>Server
  StatusNone=>Fixed
  Assigned tobananas=>rrichard
  Open/ClosedOpen=>Closed
Mon 09 Feb 2004 10:07:47 AM UTCrrichardStatusInvalid=>None
  Assigned toNone=>bananas
  Open/ClosedClosed=>Open
  SummaryApparent memory corruption in options=>Apparent memory corruption in options (reopen)
Mon 09 Feb 2004 10:07:46 AM UTCrrichardSeverity1 - Non-critical=>9 - Critical
Sat 07 Feb 2004 11:02:23 AM UTCrrichardSeverity9 - Critical=>1 - Non-critical
  StatusNone=>Invalid
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1