From 6423ecea3745decd4cf6a9fe268f204d10087534 Mon Sep 17 00:00:00 2001 From: yinbin Date: Thu, 18 Sep 2025 16:51:49 +0800 Subject: [PATCH] API_MSG: fix SIGFPE in x86 env (cherry picked from commit 5f98c8b130aa5a636083b83a4d0588b78b143f9c) --- 0196-API_MSG-fix-SIGFPE-in-x86-env.patch | 30 ++++++++++++++++++++++++ lwip.spec | 6 ++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 0196-API_MSG-fix-SIGFPE-in-x86-env.patch diff --git a/0196-API_MSG-fix-SIGFPE-in-x86-env.patch b/0196-API_MSG-fix-SIGFPE-in-x86-env.patch new file mode 100644 index 0000000..fa5ac37 --- /dev/null +++ b/0196-API_MSG-fix-SIGFPE-in-x86-env.patch @@ -0,0 +1,30 @@ +From 492c45946da93c2569b0e609042e9fee2b3dc998 Mon Sep 17 00:00:00 2001 +From: yinbin +Date: Thu, 18 Sep 2025 16:42:23 +0800 +Subject: [PATCH] API_MSG: fix SIGFPE in x86 env. + + +diff --git a/src/api/api_msg.c b/src/api/api_msg.c +index b600f26..6ef1435 100644 +--- a/src/api/api_msg.c ++++ b/src/api/api_msg.c +@@ -1728,9 +1728,13 @@ u32_t lwip_netconn_get_recvd(struct netconn *conn, u16_t len, u16_t cnt) + + conn->pcb.tcp->unrcved_len += len; + conn->pcb.tcp->unrcved_cnt += cnt; +- percnt_len = conn->pcb.tcp->unrcved_len / conn->pcb.tcp->unrcved_cnt; +- recvd = percnt_len * (conn->pcb.tcp->unrcved_cnt - mboxcnt); +- ++ if (conn->pcb.tcp->unrcved_cnt > 0) { ++ percnt_len = conn->pcb.tcp->unrcved_len / conn->pcb.tcp->unrcved_cnt; ++ recvd = percnt_len * (conn->pcb.tcp->unrcved_cnt - mboxcnt); ++ } else { ++ recvd = 0; ++ } ++ + conn->pcb.tcp->unrcved_len -= recvd; + conn->pcb.tcp->unrcved_cnt = mboxcnt; + return recvd; +-- +2.33.0 + diff --git a/lwip.spec b/lwip.spec index 7606a05..50119fb 100644 --- a/lwip.spec +++ b/lwip.spec @@ -4,7 +4,7 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip Version: 2.2.0 -Release: 74 +Release: 75 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -211,6 +211,7 @@ Patch9192: 0192-tcp-reduce-TCP_SNDQUEUELOWAT-to-1800.patch Patch9193: 0193-fix-20.03-LTS-build-failed.patch Patch9194: 0194-sk_wait-fix-wait-not-return-EINTR-when-interrupted-b.patch Patch9195: 0195-SOCKET-add-err-log-when-have-ERROR-event.patch +Patch9196: 0196-API_MSG-fix-SIGFPE-in-x86-env.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -240,6 +241,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Thu Sep 18 2025 yinbin - 2.2.0-75 +- fix SIGFPE in x86 env + * Mon Jul 28 2025 yinbin - 2.2.0-74 - socket: add err log when have ERROR event -- Gitee