diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp index cff2cebbffe20e..96172ed05f4f66 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp @@ -138,7 +138,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0000: // accepts header list { - entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1); + entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) { ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index); @@ -155,7 +155,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - entryLength = acceptsHeaderListSpan->size(); + if (!CanCastTo(acceptsHeaderListSpan->size())) + { + ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + return 0; + } + entryLength = static_cast(acceptsHeaderListSpan->size()); break; } case 0x0001: // supported streaming types @@ -548,7 +553,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x001B: // list_octet_string { - entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1); + entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) { ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index); @@ -565,7 +570,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - entryLength = listOctetStringSpan->size(); + if (!CanCastTo(listOctetStringSpan->size())) + { + ChipLogError(Zcl, "Span size %zu is too large", listOctetStringSpan->size()); + return 0; + } + entryLength = static_cast(listOctetStringSpan->size()); break; } case 0x001C: // list_struct_octet_string diff --git a/examples/tv-app/tv-common/gen/attribute-size.cpp b/examples/tv-app/tv-common/gen/attribute-size.cpp index 1a8c6cc4d78fd3..d2cd645eb78ab6 100644 --- a/examples/tv-app/tv-common/gen/attribute-size.cpp +++ b/examples/tv-app/tv-common/gen/attribute-size.cpp @@ -138,7 +138,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0000: // accepts header list { - entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1); + entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) { ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index); @@ -155,7 +155,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - entryLength = acceptsHeaderListSpan->size(); + if (!CanCastTo(acceptsHeaderListSpan->size())) + { + ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + return 0; + } + entryLength = static_cast(acceptsHeaderListSpan->size()); break; } case 0x0001: // supported streaming types diff --git a/src/controller/data_model/gen/CHIPClientCallbacks.cpp b/src/controller/data_model/gen/CHIPClientCallbacks.cpp index 49752b1f185c40..b228ec4ef1db49 100644 --- a/src/controller/data_model/gen/CHIPClientCallbacks.cpp +++ b/src/controller/data_model/gen/CHIPClientCallbacks.cpp @@ -881,10 +881,10 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag data[i].LQI = emberAfGetInt8u(message, 0, 1); message += 1; CHECK_MESSAGE_LENGTH(1); - data[i].AverageRssi = emberAfGetInt8u(message, 0, 1); + data[i].AverageRssi = emberAfGetInt8s(message, 0, 1); message += 1; CHECK_MESSAGE_LENGTH(1); - data[i].LastRssi = emberAfGetInt8u(message, 0, 1); + data[i].LastRssi = emberAfGetInt8s(message, 0, 1); message += 1; CHECK_MESSAGE_LENGTH(1); data[i].FrameErrorRate = emberAfGetInt8u(message, 0, 1);