Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encourage the use of CopyCharSpanToMutableCharSpanWithTruncation #35444

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

hicklin
Copy link
Contributor

@hicklin hicklin commented Sep 6, 2024

  • Updates the service area code documentation to encourage the use of CopyCharSpanToMutableCharSpanWithTruncation in methods that do not provide a way propagate errors.
  • Updates the rvc-app example to use CopyCharSpanToMutableCharSpanWithTruncation.

…arSpanToMutableCharSpanWithTruncation for memory safety. Updated the rvc-app example to use this method.
Copy link

Review changes with SemanticDiff.

Copy link

github-actions bot commented Sep 6, 2024

PR #35444: Size comparison from 0b696d8 to 1fddb2b

Full report (77 builds for bl602, bl702, bl702l, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 0b696d8 1fddb2b change % change
bl602 lighting-app bl602 FLASH 1279600 1279600 0 0.0
RAM 95904 95904 0 0.0
bl602+mfd FLASH 1293710 1293710 0 0.0
RAM 96048 96048 0 0.0
bl602+rpc FLASH 1318564 1318564 0 0.0
RAM 104328 104328 0 0.0
bl702 lighting-app bl702 FLASH 944934 944934 0 0.0
RAM 15209 15209 0 0.0
bl702+mfd FLASH 947334 947334 0 0.0
RAM 15353 15353 0 0.0
bl702+rpc FLASH 1040246 1040246 0 0.0
RAM 24221 24221 0 0.0
bl706-eth FLASH 648006 648006 0 0.0
RAM 25305 25305 0 0.0
bl706-wifi FLASH 895420 895420 0 0.0
RAM 14525 14525 0 0.0
bl702l lighting-app bl702l FLASH 961594 961594 0 0.0
RAM 16868 16868 0 0.0
bl702l+mfd FLASH 964216 964216 0 0.0
RAM 17012 17012 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 678265 678265 0 0.0
RAM 78556 78556 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 698117 698117 0 0.0
RAM 81188 81188 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 698117 698117 0 0.0
RAM 81188 81188 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 655053 655053 0 0.0
RAM 73624 73624 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614601 614601 0 0.0
RAM 71524 71524 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634237 634237 0 0.0
RAM 74076 74076 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634237 634237 0 0.0
RAM 74076 74076 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 632625 632625 0 0.0
RAM 74540 74540 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 652341 652341 0 0.0
RAM 77092 77092 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 652341 652341 0 0.0
RAM 77092 77092 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 606917 606917 0 0.0
RAM 68580 68580 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 626769 626769 0 0.0
RAM 71212 71212 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 626769 626769 0 0.0
RAM 71212 71212 0 0.0
efr32 lighting-app BRD4187C FLASH 933684 933684 0 0.0
RAM 135120 135120 0 0.0
lock-app BRD4338a FLASH 740804 740804 0 0.0
RAM 197184 197184 0 0.0
window-app BRD4187C FLASH 1017480 1017472 -8 -0.0
RAM 127060 127060 0 0.0
esp32 all-clusters-app c3devkit DRAM 94128 94128 0 0.0
FLASH 1538110 1538110 0 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 115064 115064 0 0.0
FLASH 1548558 1548558 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4688 4688 0 0.0
FLASH 2768253 2768253 0 0.0
RAM 128808 128808 0 0.0
all-clusters-app debug unknown 5456 5456 0 0.0
FLASH 6079122 6079122 0 0.0
RAM 510840 510840 0 0.0
all-clusters-minimal-app debug unknown 5352 5352 0 0.0
FLASH 5403236 5403236 0 0.0
RAM 240648 240648 0 0.0
bridge-app debug unknown 5336 5336 0 0.0
FLASH 4737058 4737058 0 0.0
RAM 217640 217640 0 0.0
chip-tool debug unknown 5888 5888 0 0.0
FLASH 12653086 12653086 0 0.0
RAM 558570 558570 0 0.0
chip-tool-ipv6only arm64 unknown 20368 20368 0 0.0
FLASH 11325156 11325156 0 0.0
RAM 608672 608672 0 0.0
fabric-admin debug unknown 5720 5720 0 0.0
FLASH 10960469 10960469 0 0.0
RAM 557562 557562 0 0.0
fabric-bridge-app debug unknown 4568 4568 0 0.0
FLASH 4559860 4559860 0 0.0
RAM 204288 204288 0 0.0
lighting-app debug+rpc+ui unknown 5984 5984 0 0.0
FLASH 5684561 5684561 0 0.0
RAM 228456 228456 0 0.0
lock-app debug unknown 5272 5272 0 0.0
FLASH 4791694 4791694 0 0.0
RAM 204040 204040 0 0.0
ota-provider-app debug unknown 4648 4648 0 0.0
FLASH 4431200 4431200 0 0.0
RAM 198024 198024 0 0.0
ota-requestor-app debug unknown 4584 4584 0 0.0
FLASH 4569776 4569776 0 0.0
RAM 202560 202560 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 3105469 3105469 0 0.0
RAM 159520 159520 0 0.0
thermostat-no-ble arm64 unknown 9320 9320 0 0.0
FLASH 4330692 4330692 0 0.0
RAM 242240 242240 0 0.0
tv-app debug unknown 5552 5552 0 0.0
FLASH 6018149 6018149 0 0.0
RAM 583512 583512 0 0.0
tv-casting-app debug unknown 5208 5208 0 0.0
FLASH 10859293 10859293 0 0.0
RAM 646200 646200 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914064 914064 0 0.0
RAM 142252 142252 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 885732 885732 0 0.0
RAM 140391 140391 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 845456 845456 0 0.0
RAM 141070 141070 0 0.0
nxp contact k32w0+release FLASH 579500 579500 0 0.0
RAM 70676 70676 0 0.0
k32w1+release FLASH 593328 593328 0 0.0
RAM 62712 62712 0 0.0
light k32w0+release FLASH 615128 615128 0 0.0
RAM 70140 70140 0 0.0
k32w1+release FLASH 676952 676952 0 0.0
RAM 47848 47848 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1645964 1645964 0 0.0
RAM 210944 210944 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1549596 1549596 0 0.0
RAM 207656 207656 0 0.0
light cy8ckit_062s2_43012 FLASH 1468388 1468388 0 0.0
RAM 200752 200752 0 0.0
lock cy8ckit_062s2_43012 FLASH 1463660 1463660 0 0.0
RAM 225064 225064 0 0.0
qpg lighting-app qpg6105+debug FLASH 657804 657804 0 0.0
RAM 105192 105192 0 0.0
lock-app qpg6105+debug FLASH 615960 615960 0 0.0
RAM 99660 99660 0 0.0
stm32 light STM32WB5MM-DK FLASH 481608 481608 0 0.0
RAM 144740 144740 0 0.0
telink air-quality-sensor-app tlsr9528a_retention FLASH 620810 620810 0 0.0
RAM 50940 50940 0 0.0
all-clusters-app tlsr9118bdk40d FLASH 686304 686304 0 0.0
RAM 149584 149584 0 0.0
all-clusters-minimal-app tlsr9528a FLASH 778744 778744 0 0.0
RAM 110744 110744 0 0.0
bridge-app tlsr9258a FLASH 679804 679804 0 0.0
RAM 91596 91596 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 622402 622402 0 0.0
RAM 50980 50980 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 708414 708414 0 0.0
RAM 74320 74320 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 624604 624604 0 0.0
RAM 145564 145564 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 810734 810734 0 0.0
RAM 99488 99488 0 0.0
lock-app-dfu tlsr9528a FLASH 655386 655386 0 0.0
RAM 67016 67016 0 0.0
ota-requestor-app tlsr9258a FLASH 697670 697670 0 0.0
RAM 91280 91280 0 0.0
pump-app-usb tlsr9518adk80d FLASH 632112 632112 0 0.0
RAM 55760 55760 0 0.0
pump-controller-app tlsr9518adk80d FLASH 609360 609360 0 0.0
RAM 53004 53004 0 0.0
shell tlsr9518adk80d FLASH 467196 467196 0 0.0
RAM 68668 68668 0 0.0
smoke_co_alarm-app tlsr9528a_retention FLASH 629188 629188 0 0.0
RAM 52700 52700 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d FLASH 653342 653342 0 0.0
RAM 56640 56640 0 0.0
thermostat tlsr9518adk80d FLASH 636092 636092 0 0.0
RAM 53408 53408 0 0.0
window-covering tlsr9118bdk40d FLASH 523346 523346 0 0.0
RAM 98540 98540 0 0.0
tizen all-clusters-app arm unknown 4840 4840 0 0.0
FLASH 1722416 1722416 0 0.0
RAM 89548 89548 0 0.0
chip-tool-ubsan arm unknown 10272 10272 0 0.0
FLASH 17499570 17499570 0 0.0
RAM 7596248 7596248 0 0.0

Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but note that truncation can produce interesting garbage at the truncation point in languages other than English where the UTF-8 encoding of characters is multi-byte....

Copy link

github-actions bot commented Sep 11, 2024

PR #35444: Size comparison from edf1f65 to 51c437f

Full report (77 builds for bl602, bl702, bl702l, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section edf1f65 51c437f change % change
bl602 lighting-app bl602 FLASH 1278156 1278156 0 0.0
RAM 95832 95832 0 0.0
bl602+mfd FLASH 1292010 1292010 0 0.0
RAM 95968 95968 0 0.0
bl602+rpc FLASH 1317120 1317120 0 0.0
RAM 104256 104256 0 0.0
bl702 lighting-app bl702 FLASH 943860 943860 0 0.0
RAM 15153 15153 0 0.0
bl702+mfd FLASH 946260 946260 0 0.0
RAM 15305 15305 0 0.0
bl702+rpc FLASH 1039180 1039180 0 0.0
RAM 24173 24173 0 0.0
bl706-eth FLASH 646056 646056 0 0.0
RAM 25241 25241 0 0.0
bl706-wifi FLASH 894048 894048 0 0.0
RAM 14477 14477 0 0.0
bl702l lighting-app bl702l FLASH 960520 960520 0 0.0
RAM 16812 16812 0 0.0
bl702l+mfd FLASH 963142 963142 0 0.0
RAM 16964 16964 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 677089 677089 0 0.0
RAM 78484 78484 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 696941 696941 0 0.0
RAM 81124 81124 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 696941 696941 0 0.0
RAM 81124 81124 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 653877 653877 0 0.0
RAM 73552 73552 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613273 613273 0 0.0
RAM 71460 71460 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 632909 632909 0 0.0
RAM 74004 74004 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 632909 632909 0 0.0
RAM 74004 74004 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 632385 632385 0 0.0
RAM 74508 74508 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 652101 652101 0 0.0
RAM 77052 77052 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 652101 652101 0 0.0
RAM 77052 77052 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 607897 607897 0 0.0
RAM 68596 68596 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 627749 627749 0 0.0
RAM 71236 71236 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 627749 627749 0 0.0
RAM 71236 71236 0 0.0
efr32 lighting-app BRD4187C FLASH 932464 932464 0 0.0
RAM 135060 135060 0 0.0
lock-app BRD4338a FLASH 740556 740548 -8 -0.0
RAM 231244 231244 0 0.0
window-app BRD4187C FLASH 1015500 1015492 -8 -0.0
RAM 127000 127000 0 0.0
esp32 all-clusters-app c3devkit DRAM 94168 94168 0 0.0
FLASH 1539596 1539596 0 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 115112 115112 0 0.0
FLASH 1549894 1549894 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4688 4688 0 0.0
FLASH 2771087 2771087 0 0.0
RAM 128928 128928 0 0.0
all-clusters-app debug unknown 5456 5456 0 0.0
FLASH 6082720 6082720 0 0.0
RAM 514432 514432 0 0.0
all-clusters-minimal-app debug unknown 5352 5352 0 0.0
FLASH 5406670 5406670 0 0.0
RAM 240784 240784 0 0.0
bridge-app debug unknown 5336 5336 0 0.0
FLASH 4740144 4740144 0 0.0
RAM 217824 217824 0 0.0
chip-tool debug unknown 5888 5888 0 0.0
FLASH 12676350 12676350 0 0.0
RAM 562250 562250 0 0.0
chip-tool-ipv6only arm64 unknown 20384 20384 0 0.0
FLASH 11341524 11341524 0 0.0
RAM 612376 612376 0 0.0
fabric-admin debug unknown 5720 5720 0 0.0
FLASH 10978929 10978929 0 0.0
RAM 561306 561306 0 0.0
fabric-bridge-app debug unknown 4568 4568 0 0.0
FLASH 4562880 4562880 0 0.0
RAM 204440 204440 0 0.0
lighting-app debug+rpc+ui unknown 5984 5984 0 0.0
FLASH 5676465 5676465 0 0.0
RAM 228112 228112 0 0.0
lock-app debug unknown 5272 5272 0 0.0
FLASH 4789428 4789428 0 0.0
RAM 203912 203912 0 0.0
ota-provider-app debug unknown 4648 4648 0 0.0
FLASH 4422812 4422812 0 0.0
RAM 197616 197616 0 0.0
ota-requestor-app debug unknown 4584 4584 0 0.0
FLASH 4561356 4561356 0 0.0
RAM 202184 202184 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 3107773 3107773 0 0.0
RAM 159624 159624 0 0.0
thermostat-no-ble arm64 unknown 9336 9336 0 0.0
FLASH 4333156 4333156 0 0.0
RAM 242400 242400 0 0.0
tv-app debug unknown 5552 5552 0 0.0
FLASH 6022229 6022229 0 0.0
RAM 587104 587104 0 0.0
tv-casting-app debug unknown 5208 5208 0 0.0
FLASH 10883789 10883789 0 0.0
RAM 650224 650224 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 915168 915168 0 0.0
RAM 142272 142272 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 886472 886472 0 0.0
RAM 140411 140411 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 846520 846520 0 0.0
RAM 141090 141090 0 0.0
nxp contact k32w0+release FLASH 580324 580324 0 0.0
RAM 70704 70704 0 0.0
k32w1+release FLASH 594120 594120 0 0.0
RAM 62736 62736 0 0.0
light k32w0+release FLASH 616088 616088 0 0.0
RAM 70168 70168 0 0.0
k32w1+release FLASH 677896 677896 0 0.0
RAM 47880 47880 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646988 1646988 0 0.0
RAM 210968 210968 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1550612 1550612 0 0.0
RAM 207680 207680 0 0.0
light cy8ckit_062s2_43012 FLASH 1466436 1466436 0 0.0
RAM 200672 200672 0 0.0
lock cy8ckit_062s2_43012 FLASH 1462956 1462956 0 0.0
RAM 225024 225024 0 0.0
qpg lighting-app qpg6105+debug FLASH 658924 658924 0 0.0
RAM 105220 105220 0 0.0
lock-app qpg6105+debug FLASH 616864 616864 0 0.0
RAM 99680 99680 0 0.0
stm32 light STM32WB5MM-DK FLASH 480544 480544 0 0.0
RAM 144676 144676 0 0.0
telink air-quality-sensor-app tlsr9528a_retention FLASH 621718 621718 0 0.0
RAM 50964 50964 0 0.0
all-clusters-app tlsr9118bdk40d FLASH 687326 687326 0 0.0
RAM 149608 149608 0 0.0
all-clusters-minimal-app tlsr9528a FLASH 779908 779908 0 0.0
RAM 110768 110768 0 0.0
bridge-app tlsr9258a FLASH 680802 680802 0 0.0
RAM 91620 91620 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 621482 621482 0 0.0
RAM 50916 50916 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 707514 707514 0 0.0
RAM 74256 74256 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 623742 623742 0 0.0
RAM 145500 145500 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 810036 810036 0 0.0
RAM 99424 99424 0 0.0
lock-app-dfu tlsr9528a FLASH 655346 655346 0 0.0
RAM 66976 66976 0 0.0
ota-requestor-app tlsr9258a FLASH 696778 696778 0 0.0
RAM 91212 91212 0 0.0
pump-app-usb tlsr9518adk80d FLASH 633094 633094 0 0.0
RAM 55784 55784 0 0.0
pump-controller-app tlsr9518adk80d FLASH 610282 610282 0 0.0
RAM 53028 53028 0 0.0
shell tlsr9518adk80d FLASH 467196 467196 0 0.0
RAM 68668 68668 0 0.0
smoke_co_alarm-app tlsr9528a_retention FLASH 628260 628260 0 0.0
RAM 52636 52636 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d FLASH 652418 652418 0 0.0
RAM 56576 56576 0 0.0
thermostat tlsr9518adk80d FLASH 637014 637014 0 0.0
RAM 53432 53432 0 0.0
window-covering tlsr9118bdk40d FLASH 522258 522258 0 0.0
RAM 98476 98476 0 0.0
tizen all-clusters-app arm unknown 4852 4852 0 0.0
FLASH 1724808 1724808 0 0.0
RAM 89608 89608 0 0.0
chip-tool-ubsan arm unknown 10284 10284 0 0.0
FLASH 17532394 17532394 0 0.0
RAM 7609864 7609864 0 0.0

@mergify mergify bot merged commit 4f25d84 into project-chip:master Sep 11, 2024
67 checks passed
yyzhong-g pushed a commit to yyzhong-g/connectedhomeip that referenced this pull request Dec 12, 2024
…ject-chip#35444)

* Updated the service area documentation to encourage the use of CopyCharSpanToMutableCharSpanWithTruncation for memory safety. Updated the rvc-app example to use this method.

* Restyled by whitespace

---------

Co-authored-by: Restyled.io <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants