lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #33672] checksum calculate error!!!


From: hanhui
Subject: [lwip-devel] [bug #33672] checksum calculate error!!!
Date: Wed, 29 Jun 2011 17:39:01 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3

URL:
  <http://savannah.nongnu.org/bugs/?33672>

                 Summary: checksum calculate error!!!
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hanhui03
            Submitted on: Wed Jun 29 17:39:00 2011
                Category: None
                Severity: 3 - Normal
              Item Group: Crash Error
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

in some cases, checksum calculate error!

for example:

inet_cksum_pseudo_partial_base(...)
{
  ...
  for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
    ...
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = 1 - swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }
    ...
  }
}

line : acc = FOLD_U32T(acc); Can not guarantee that upper 16bit is 0

so it should be:

    acc = FOLD_U32T(acc);
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = 1 - swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }

A similar error also exists in many places!!!

Debugging is very difficult to find this errors, CODING WITH CAUTION PLEASE!
THANK YOU!







    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?33672>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]