lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9294] memp: Fix memp_overflow_check_element_underfl


From: Axel Lin
Subject: [lwip-devel] [patch #9294] memp: Fix memp_overflow_check_element_underflow/overflow assertion
Date: Thu, 23 Mar 2017 05:45:59 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

URL:
  <http://savannah.nongnu.org/patch/?9294>

                 Summary: memp: Fix
memp_overflow_check_element_underflow/overflow assertion
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: axellin
            Submitted on: Thu 23 Mar 2017 09:45:58 AM UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

My debugger keep hitting below assertion in debug build.
git bicect to commit e5f9f187adfa, fix it.

        info "(gdb)Auto-loading safe path"
memp_overflow_check_element_underflow (p=0x200067fc
<memp_memory_TCPIP_MSG_INPKT_base+1320>, desc=0x8088298
<memp_TCPIP_MSG_INPKT>) at src/core/memp.c:163
163         if (m[k] != 0xcd) {
(gdb) l
158     #if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0
159       u16_t k;
160       u8_t *m;
161       m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED;
162       for (k = 0; k < MEMP_SANITY_REGION_BEFORE_ALIGNED; k++) {
163         if (m[k] != 0xcd) {
164           char errstr[128] = "detected memp underflow in pool ";
165           strcat(errstr, desc->desc);
166           LWIP_ASSERT(errstr, 0);
167         }
(gdb)

I also did a small test to show the difference:
p = LWIP_ALIGNMENT_CAST(struct memp*, ((u8_t*)p + MEMP_SIZE +
memp_pools[i]->size + MEMP_SANITY_REGION_AFTER_ALIGNED));
p1 = LWIP_ALIGNMENT_CAST(struct memp*, (size_t)((u8_t*)p + MEMP_SIZE +
memp_pools[i]->size + MEMP_SANITY_REGION_AFTER_ALIGNED));
p1=0x20002d0c p=0x20002cc4

Fixes: e5f9f187adfa ("Continue to fix incorrect casts via size_t for some
platforms")




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 23 Mar 2017 09:45:58 AM UTC  Name:
0001-memp-Fix-memp_overflow_check_element_underflow-overf.patch  Size: 2kB  
By: axellin

<http://savannah.nongnu.org/patch/download.php?file_id=40092>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9294>

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




reply via email to

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