You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/22 09:44:16 UTC
(mynewt-newtmgr) branch master updated (376a1b6 -> 85b0589)
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
from 376a1b6 ci: Report more CodeQL findings
new f5be392 nmxact/nmble: Remove unreachable return in BleBytes.MarshalJSON
new 9929674 nmxact/nmxutil: Remove unreachable return in SingleResource.Release
new 85b0589 nmxact/nmcoap: Do not panic on invalid CoAP-TCP packet
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
nmxact/nmble/ble_proto.go | 5 +----
nmxact/nmcoap/frag.go | 2 +-
nmxact/nmxutil/sres.go | 1 -
3 files changed, 2 insertions(+), 6 deletions(-)
(mynewt-newtmgr) 03/03: nmxact/nmcoap: Do not panic on invalid CoAP-TCP packet
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 85b05893a889ccfd30d55d4df25cbd2b0ac09200
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 21 23:29:30 2026 +0200
nmxact/nmcoap: Do not panic on invalid CoAP-TCP packet
Commit 0dd1daa ("nmxact: API change for CoAP operations") added a
panic("GA") in Reassembler.RxFrag() when coap.PullTcp() fails, which
looks like a debugging leftover. It made the following "return nil"
unreachable and lets any malformed packet received from a device
crash the whole program.
Simply removing the panic is not enough: on decode error PullTcp()
returns the input buffer unchanged, so the invalid bytes would stay
in the reassembly buffer and every subsequent fragment would be
appended to them and fail to decode as well. Drop the buffered data
on error so that reception can recover with the next packet.
Assisted-by: Claude:claude-opus-5-5
---
nmxact/nmcoap/frag.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nmxact/nmcoap/frag.go b/nmxact/nmcoap/frag.go
index 5bb5526..a7371d7 100644
--- a/nmxact/nmcoap/frag.go
+++ b/nmxact/nmcoap/frag.go
@@ -40,7 +40,7 @@ func (r *Reassembler) RxFrag(frag []byte) *coap.TcpMessage {
tm, r.cur, err = coap.PullTcp(r.cur)
if err != nil {
log.Debugf("received invalid CoAP-TCP packet: %s", err.Error())
- panic("GA")
+ r.cur = nil
return nil
}
(mynewt-newtmgr) 01/03: nmxact/nmble: Remove unreachable return in BleBytes.MarshalJSON
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit f5be3928ba3e4f88808d43bdb4e84a7d35bb6a06
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 21 23:22:38 2026 +0200
nmxact/nmble: Remove unreachable return in BleBytes.MarshalJSON
The function returned json.Marshal(s) followed by a leftover
"return buf.Bytes(), nil" that could never execute. That dead path
would also have produced invalid JSON (an unquoted 0x01:0x02 string)
which UnmarshalJSON could not parse, so the reachable path is the
correct one. Drop the dead statement and the temporary variable.
Assisted-by: Claude:claude-opus-5-5
---
nmxact/nmble/ble_proto.go | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/nmxact/nmble/ble_proto.go b/nmxact/nmble/ble_proto.go
index ebcae93..37243ae 100644
--- a/nmxact/nmble/ble_proto.go
+++ b/nmxact/nmble/ble_proto.go
@@ -1606,10 +1606,7 @@ func (bb *BleBytes) MarshalJSON() ([]byte, error) {
fmt.Fprintf(&buf, "0x%02x", b)
}
- s := buf.String()
- return json.Marshal(s)
-
- return buf.Bytes(), nil
+ return json.Marshal(buf.String())
}
func (bb *BleBytes) UnmarshalJSON(data []byte) error {
(mynewt-newtmgr) 02/03: nmxact/nmxutil: Remove unreachable return in SingleResource.Release
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 9929674af2c00b3fcf19475d2d489c9858a0daf4
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 21 23:29:30 2026 +0200
nmxact/nmxutil: Remove unreachable return in SingleResource.Release
The "return nil" following the panic on release without acquire can
never execute. Drop it; the panic itself is intended as it signals a
programming error.
Assisted-by: Claude:claude-opus-5-5
---
nmxact/nmxutil/sres.go | 1 -
1 file changed, 1 deletion(-)
diff --git a/nmxact/nmxutil/sres.go b/nmxact/nmxutil/sres.go
index 45c9093..5e6027f 100644
--- a/nmxact/nmxutil/sres.go
+++ b/nmxact/nmxutil/sres.go
@@ -76,7 +76,6 @@ func (s *SingleResource) Release() bool {
if !s.acquired {
panic("SingleResource release without acquire")
- return nil
}
if len(s.waitQueue) == 0 {