Skip to content

Fix appending to Strings longer than 64k #11523

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

Merged
merged 1 commit into from
Jun 30, 2025

Conversation

MattiasTF
Copy link
Contributor

If oldLen is truncated to uint16_t, appending to a String that is longer than 65535 bytes will create a broken String.

@MattiasTF MattiasTF requested a review from a team as a code owner June 27, 2025 09:21
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Warnings
⚠️

The source branch "fix-String" incorrect format:

  • contains uppercase letters. This can cause troubles on case-insensitive file systems (macOS).
    Please rename your branch.

👋 Hello MattiasTF, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against fcec146

If oldLen is truncated to uint16_t, appending to a String
that is longer than 65535 bytes will create a broken string.
@MattiasTF MattiasTF closed this Jun 27, 2025
@MattiasTF MattiasTF deleted the fix-String branch June 27, 2025 09:31
@MattiasTF MattiasTF restored the fix-String branch June 27, 2025 09:31
@MattiasTF MattiasTF reopened this Jun 27, 2025
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Test Results

 76 files   76 suites   13m 51s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit fcec146.

♻️ This comment has been updated with latest results.

@lucasssvaz lucasssvaz requested a review from me-no-dev June 27, 2025 09:51
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32P4💚 -1000.000.00000.000.00
ESP32S3000.000.00000.000.00
ESP32S2💚 -1200.000.00000.000.00
ESP32C3💚 -1000.000.00000.000.00
ESP32C6💚 -1000.000.00000.000.00
ESP32H2💚 -1000.000.00000.000.00
ESP32💚 -16⚠️ +200.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
ArduinoOTA/examples/BasicOTA0000💚 -400000--00
AsyncUDP/examples/AsyncUDPClient0000💚 -400000--00
AsyncUDP/examples/AsyncUDPMulticastServer0000💚 -400000--00
AsyncUDP/examples/AsyncUDPServer0000💚 -400000--00
DNSServer/examples/CaptivePortal0000💚 -400000--00
EEPROM/examples/eeprom_class0000💚 -4000000000
EEPROM/examples/eeprom_extra0000💚 -4000000000
EEPROM/examples/eeprom_write0000💚 -4000000000
ESP32/examples/AnalogOut/LEDCFade0000💚 -4000000000
ESP32/examples/AnalogOut/LEDCGammaFade00------0000--
ESP32/examples/AnalogOut/LEDCSingleChannel0000💚 -4000000000
ESP32/examples/AnalogOut/LEDCSoftwareFade0000💚 -4000000000
ESP32/examples/AnalogOut/SigmaDelta0000💚 -4000000000
ESP32/examples/AnalogOut/ledcFrequency0000💚 -4000000000
ESP32/examples/AnalogOut/ledcWrite_RGB0000💚 -4000000000
ESP32/examples/AnalogRead0000💚 -4000000000
ESP32/examples/AnalogReadContinuous0000💚 -4000000000
ESP32/examples/ArduinoStackSize0000💚 -4000000000
ESP32/examples/CI/CIBoardsTest0000💚 -4000000000
ESP32/examples/ChipID/GetChipID0000💚 -4000000000
ESP32/examples/DeepSleep/TimerWakeUp0000💚 -400000--00
ESP32/examples/DeepSleep/TouchWakeUp0000💚 -40------00
ESP32/examples/FreeRTOS/BasicMultiThreading0000💚 -4000000000
ESP32/examples/FreeRTOS/Mutex0000💚 -4000000000
ESP32/examples/FreeRTOS/Queue0000💚 -4000000000
ESP32/examples/FreeRTOS/Semaphore0000💚 -4000000000
ESP32/examples/GPIO/BlinkRGB0000💚 -4000000000
ESP32/examples/GPIO/FunctionalInterrupt0000💚 -4000000000
ESP32/examples/GPIO/FunctionalInterruptStruct0000💚 -4000000000
ESP32/examples/GPIO/GPIOInterrupt0000💚 -4000000000
ESP32/examples/HWCDC_Events0000--000000--
ESP32/examples/MacAddress/GetMacAddress0000💚 -4000000000
ESP32/examples/RMT/Legacy_RMT_Driver_Compatible0000💚 -4000000000
ESP32/examples/RMT/RMTCallback0000💚 -4000000000
ESP32/examples/RMT/RMTLoopback0000💚 -4000000000
ESP32/examples/RMT/RMTReadXJT0000💚 -4000000000
ESP32/examples/RMT/RMTWrite_RGB_LED0000💚 -40💚 -100000000
ESP32/examples/RMT/RMT_CPUFreq_Test0000💚 -4000000000
ESP32/examples/RMT/RMT_EndOfTransmissionState0000💚 -4000000000
ESP32/examples/RMT/RMT_LED_Blink0000💚 -40💚 -100000000
ESP32/examples/ResetReason/ResetReason0000💚 -40💚 -100000000
ESP32/examples/ResetReason/ResetReason20000💚 -4000000000
ESP32/examples/Serial/BaudRateDetect_Demo0000💚 -4000000000
ESP32/examples/Serial/OnReceiveError_BREAK_Demo0000💚 -4000000000
ESP32/examples/Serial/OnReceive_Demo0000💚 -4000000000
ESP32/examples/Serial/RS485_Echo_Demo0000💚 -4000💚 -1000000
ESP32/examples/Serial/RxFIFOFull_Demo0000💚 -4000000000
ESP32/examples/Serial/RxTimeout_Demo0000💚 -4000000000
ESP32/examples/Serial/Serial_All_CPU_Freqs0000💚 -4000000000
ESP32/examples/Serial/Serial_STD_Func_OnReceive0000💚 -4000000000
ESP32/examples/Serial/onReceiveExample0000💚 -4000000000
ESP32/examples/TWAI/TWAIreceive0000💚 -4000000000
ESP32/examples/TWAI/TWAItransmit0000💚 -4000000000
ESP32/examples/Template/ExampleTemplate0000💚 -4000000000
ESP32/examples/Time/SimpleTime0000💚 -400000--00
ESP32/examples/Timer/RepeatTimer0000💚 -4000000000
ESP32/examples/Timer/WatchdogTimer0000💚 -4000000000
ESP32/examples/Touch/TouchInterrupt0000💚 -40------00
ESP32/examples/Touch/TouchRead0000💚 -40------00
ESP32/examples/Utilities/HEXBuilder0000💚 -4000000000
ESP32/examples/Utilities/MD5Builder0000💚 -4000000000
ESP32/examples/Utilities/SHA1Builder0000💚 -4000000000
ESP_I2S/examples/ES8388_loopback0000💚 -4000000000
ESP_I2S/examples/Record_to_WAV0000--------00
ESP_I2S/examples/Simple_tone0000💚 -40💚 -100000000
ESPmDNS/examples/mDNS-SD_Extended0000💚 -400000--00
ESPmDNS/examples/mDNS_Web_Server0000💚 -400000--💚 -40
Ethernet/examples/ETH_TLK11000----------00
Ethernet/examples/ETH_W5500_Arduino_SPI0000💚 -4000000000
Ethernet/examples/ETH_W5500_IDF_SPI0000💚 -4000000000
Ethernet/examples/ETH_WIFI_BRIDGE0000💚 -400000--00
FFat/examples/FFat_Test0000💚 -4000000000
FFat/examples/FFat_time0000💚 -400000--00
HTTPClient/examples/Authorization0000💚 -400000--00
HTTPClient/examples/BasicHttpClient0000💚 -400000--00
HTTPClient/examples/BasicHttpsClient0000💚 -400000--00
HTTPClient/examples/ReuseConnection0000💚 -400000--⚠️ +160
HTTPClient/examples/StreamHttpClient0000💚 -400000--00
HTTPUpdate/examples/httpUpdate0000💚 -400000--00
HTTPUpdate/examples/httpUpdateSPIFFS0000💚 -400000--00
HTTPUpdate/examples/httpUpdateSecure0000💚 -400000--00
HTTPUpdateServer/examples/WebUpdater0000💚 -400000--00
LittleFS/examples/LITTLEFS_test0000💚 -4000💚 -1000000
LittleFS/examples/LITTLEFS_time0000💚 -400000--00
NetBIOS/examples/ESP_NBNST0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientInsecure0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientPSK0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientSecure0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientShowPeerCredentials0000💚 -400000--00
NetworkClientSecure/examples/WiFiClientTrustOnFirstUse0000💚 -400000--00
PPP/examples/PPP_Basic0000💚 -4000000000
PPP/examples/PPP_WIFI_BRIDGE0000💚 -400000--00
Preferences/examples/Prefs2Struct0000💚 -4000000000
Preferences/examples/StartCounter0000💚 -4000000000
SD/examples/SD_Test0000💚 -4000000000
SD/examples/SD_time0000💚 -400000--00
SD_MMC/examples/SD2USBMSC0000----------
SD_MMC/examples/SDMMC_Test0000--------00
SD_MMC/examples/SDMMC_time0000--------00
SPI/examples/SPI_Multiple_Buses0000💚 -4000000000
SPIFFS/examples/SPIFFS_Test0000💚 -4000000000
SPIFFS/examples/SPIFFS_time0000💚 -400000--00
TFLiteMicro/examples/hello_world0000💚 -4000000000
Ticker/examples/Blinker0000💚 -4000000000
Ticker/examples/TickerBasic0000💚 -4000000000
Ticker/examples/TickerParameter0000💚 -4000000000
USB/examples/CompositeDevice💚 -10000💚 -40--------
USB/examples/ConsumerControl0000💚 -40--------
USB/examples/CustomHIDDevice0000💚 -40--------
USB/examples/FirmwareMSC0000💚 -40--------
USB/examples/Gamepad0000💚 -40--------
USB/examples/HIDVendor0000💚 -40--------
USB/examples/Keyboard/KeyboardLogout0000💚 -40--------
USB/examples/Keyboard/KeyboardMessage0000💚 -40--------
USB/examples/Keyboard/KeyboardReprogram0000💚 -40--------
USB/examples/Keyboard/KeyboardSerial0000💚 -40--------
USB/examples/KeyboardAndMouseControl0000💚 -40--------
USB/examples/MIDI/MidiController0000💚 -40--------
USB/examples/MIDI/MidiInterface0000💚 -40--------
USB/examples/MIDI/MidiMusicBox0000💚 -40--------
USB/examples/MIDI/ReceiveMidi0000💚 -40--------
USB/examples/Mouse/ButtonMouseControl0000💚 -40--------
USB/examples/SystemControl0000💚 -40--------
USB/examples/USBMSC0000💚 -40--------
USB/examples/USBSerial0000💚 -40--------
USB/examples/USBVendor0000💚 -40--------
Update/examples/AWS_S3_OTA_Update0000💚 -400000--00
Update/examples/HTTPS_OTA_Update0000💚 -400000--00
Update/examples/HTTP_Client_AES_OTA_Update0000💚 -400000--00
Update/examples/HTTP_Server_AES_OTA_Update0000💚 -400000--00
Update/examples/OTAWebUpdater0000💚 -400000--00
Update/examples/SD_Update0000💚 -4000000000
WebServer/examples/AdvancedWebServer0000💚 -400000--00
WebServer/examples/FSBrowser💚 -10000💚 -40💚 -100💚 -100--00
WebServer/examples/Filters0000💚 -400000--00
WebServer/examples/HelloServer0000💚 -400000--00
WebServer/examples/HttpAdvancedAuth0000💚 -400000--00
WebServer/examples/HttpAuthCallback0000💚 -400000--00
WebServer/examples/HttpAuthCallbackInline0000💚 -400000--00
WebServer/examples/HttpBasicAuth0000💚 -400000--00
WebServer/examples/HttpBasicAuthSHA10000💚 -400000--00
WebServer/examples/HttpBasicAuthSHA1orBearerToken0000💚 -400000--00
WebServer/examples/MultiHomedServers0000💚 -400000--00
WebServer/examples/PathArgServer0000💚 -400000--00
WebServer/examples/SDWebServer0000💚 -400000--00
WebServer/examples/SimpleAuthentification0000💚 -400000--00
WebServer/examples/UploadHugeFile0000💚 -400000--00
WebServer/examples/WebServer0000💚 -400000--00
WebServer/examples/WebUpdate0000💚 -400000--00
WiFi/examples/FTM/FTM_Initiator0000💚 -400000--00
WiFi/examples/FTM/FTM_Responder0000💚 -400000--00
WiFi/examples/SimpleWiFiServer0000💚 -400000--00
WiFi/examples/WiFiAccessPoint0000💚 -400000--00
WiFi/examples/WiFiClient0000💚 -400000--00
WiFi/examples/WiFiClientBasic0000💚 -400000--00
WiFi/examples/WiFiClientConnect0000💚 -400000--00
WiFi/examples/WiFiClientEvents0000💚 -400000--00
WiFi/examples/WiFiClientStaticIP0000💚 -400000--00
WiFi/examples/WiFiExtender0000💚 -400000--00
WiFi/examples/WiFiIPv60000💚 -400000--💚 -40
WiFi/examples/WiFiMulti0000💚 -400000--00
WiFi/examples/WiFiMultiAdvanced0000💚 -400000--00
WiFi/examples/WiFiScan0000💚 -400000--00
WiFi/examples/WiFiScanAsync0000💚 -1200000--00
WiFi/examples/WiFiScanDualAntenna0000💚 -400000--00
WiFi/examples/WiFiScanTime0000💚 -400000--00
WiFi/examples/WiFiTelnetToSerial0000💚 -400000--00
WiFi/examples/WiFiUDPClient0000💚 -400000--00
Wire/examples/WireMaster0000💚 -4000000000
Wire/examples/WireScan0000💚 -4000000000
Wire/examples/WireSlave0000💚 -4000000000
BLE/examples/BLE5_extended_scan--00--000000--
BLE/examples/BLE5_multi_advertising--00--000000--
BLE/examples/BLE5_periodic_advertising--00--000000--
BLE/examples/BLE5_periodic_sync--00--000000--
BLE/examples/Beacon_Scanner--00--00000000
BLE/examples/Client--00--00000000
BLE/examples/EddystoneTLM_Beacon--00--00000000
BLE/examples/EddystoneURL_Beacon--00--00000000
BLE/examples/Notify--00--00000000
BLE/examples/Scan--00--00000000
BLE/examples/Server--00--00000000
BLE/examples/Server_multiconnect--00--00000000
BLE/examples/UART--00--00000000
BLE/examples/Write--00--00000000
BLE/examples/iBeacon--00--00000000
ESP32/examples/Camera/CameraWebServer (1)--00💚 -40------💚 -40
ESP32/examples/Camera/CameraWebServer (2)--00💚 -40------💚 -160
ESP32/examples/Camera/CameraWebServer (3)--00----------
ESP32/examples/DeepSleep/ExternalWakeUp--00💚 -40------00
ESP_NOW/examples/ESP_NOW_Broadcast_Master--00💚 -400000--00
ESP_NOW/examples/ESP_NOW_Broadcast_Slave--00💚 -400000--00
ESP_NOW/examples/ESP_NOW_Network--00💚 -400000--00
ESP_NOW/examples/ESP_NOW_Serial--00💚 -400000--00
ESP_SR/examples/Basic--00----------
HTTPClient/examples/HTTPClientEnterprise--00💚 -400000--00
Insights/examples/DiagnosticsSmokeTest--00💚 -400000--⚠️ +40
Insights/examples/MinimalDiagnostics--00💚 -400000--00
Matter/examples/MatterColorLight--00💚 -400000--00
Matter/examples/MatterCommissionTest--00💚 -400000--⚠️ +200
Matter/examples/MatterComposedLights--00💚 -400000--00
Matter/examples/MatterContactSensor--00💚 -400000--00
Matter/examples/MatterDimmableLight--00💚 -400000--00
Matter/examples/MatterEnhancedColorLight--00💚 -400000--00
Matter/examples/MatterEvents--00💚 -400000--💚 -40
Matter/examples/MatterFan--00💚 -400000--00
Matter/examples/MatterHumiditySensor--00💚 -400000--00
Matter/examples/MatterMinimum--00💚 -400000--💚 -160
Matter/examples/MatterOccupancySensor--00💚 -400000--00
Matter/examples/MatterOnIdentify--00💚 -400000--💚 -40
Matter/examples/MatterOnOffLight--00💚 -1200000--00
Matter/examples/MatterOnOffPlugin--00💚 -400000--00
Matter/examples/MatterPressureSensor--00💚 -400000--00
Matter/examples/MatterSmartButon--00💚 -400000--00
Matter/examples/MatterTemperatureLight--00💚 -400000--00
Matter/examples/MatterTemperatureSensor--00💚 -400000--00
Matter/examples/MatterThermostat--00💚 -400000--00
Matter/examples/WiFiProvWithinMatter--00💚 -400000--00
NetworkClientSecure/examples/WiFiClientSecureEnterprise--00💚 -400000--00
RainMaker/examples/RMakerCustom--00💚 -400000----
RainMaker/examples/RMakerCustomAirCooler--00💚 -400000----
RainMaker/examples/RMakerSonoffDualR3--00💚 -400000----
RainMaker/examples/RMakerSwitch--00💚 -400000----
SimpleBLE/examples/SimpleBleDevice--00--00000000
WebServer/examples/Middleware--00💚 -400000--00
WiFi/examples/WPS--00💚 -400000--00
WiFi/examples/WiFiBlueToothSwitch--00--00💚 -100--00
WiFi/examples/WiFiClientEnterprise--00💚 -400000--00
WiFi/examples/WiFiSmartConfig--00💚 -400000--00
WiFiProv/examples/WiFiProv--00💚 -400000--00
Zigbee/examples/Zigbee_Analog_Input_Output--00💚 -4000000000
Zigbee/examples/Zigbee_Color_Dimmer_Switch--00💚 -40💚 -10000💚 -10000
Zigbee/examples/Zigbee_Electrical_AC_Sensor--00💚 -4000000000
Zigbee/examples/Zigbee_Electrical_AC_Sensor_MultiPhase--00💚 -4000000000
Zigbee/examples/Zigbee_Gateway--00💚 -4000----00
Zigbee/examples/Zigbee_On_Off_Switch--00💚 -4000000000
Zigbee/examples/Zigbee_Range_Extender--00💚 -4000000000
Zigbee/examples/Zigbee_Thermostat--00💚 -4000000000
OpenThread/examples/CLI/COAP/coap_lamp--------0000--
OpenThread/examples/CLI/COAP/coap_switch--------💚 -10000--
OpenThread/examples/CLI/SimpleCLI--------0000--
OpenThread/examples/CLI/SimpleNode--------0000--
OpenThread/examples/CLI/SimpleThreadNetwork/ExtendedRouterNode--------💚 -10000--
OpenThread/examples/CLI/SimpleThreadNetwork/LeaderNode--------0000--
OpenThread/examples/CLI/SimpleThreadNetwork/RouterNode--------0000--
OpenThread/examples/CLI/ThreadScan--------0000--
OpenThread/examples/CLI/onReceive--------0000--
OpenThread/examples/Native/SimpleThreadNetwork/LeaderNode--------0000--
OpenThread/examples/Native/SimpleThreadNetwork/RouterNode--------0000--
Zigbee/examples/Zigbee_Binary_Input--------0000--
Zigbee/examples/Zigbee_CarbonDioxide_Sensor--------0000--
Zigbee/examples/Zigbee_Color_Dimmable_Light--------0000--
Zigbee/examples/Zigbee_Contact_Switch--------0000--
Zigbee/examples/Zigbee_Dimmable_Light--------0000--
Zigbee/examples/Zigbee_Electrical_DC_Sensor--------0000--
Zigbee/examples/Zigbee_Illuminance_Sensor--------0000--
Zigbee/examples/Zigbee_OTA_Client--------0000--
Zigbee/examples/Zigbee_Occupancy_Sensor--------0000--
Zigbee/examples/Zigbee_On_Off_Light--------0000--
Zigbee/examples/Zigbee_On_Off_MultiSwitch--------0000--
Zigbee/examples/Zigbee_PM25_Sensor--------0000--
Zigbee/examples/Zigbee_Power_Outlet--------0000--
Zigbee/examples/Zigbee_Pressure_Flow_Sensor--------0000--
Zigbee/examples/Zigbee_Scan_Networks--------0000--
Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy--------0000--
Zigbee/examples/Zigbee_Temperature_Sensor--------0000--
Zigbee/examples/Zigbee_Vibration_Sensor--------0000--
Zigbee/examples/Zigbee_Wind_Speed_Sensor--------0000--
Zigbee/examples/Zigbee_Window_Covering--------0000--
BluetoothSerial/examples/DiscoverConnect------------00
BluetoothSerial/examples/GetLocalMAC------------00
BluetoothSerial/examples/SerialToSerialBT------------00
BluetoothSerial/examples/SerialToSerialBTM------------💚 -40
BluetoothSerial/examples/SerialToSerialBT_Legacy------------00
BluetoothSerial/examples/SerialToSerialBT_SSP------------00
BluetoothSerial/examples/bt_classic_device_discovery------------00
BluetoothSerial/examples/bt_remove_paired_devices------------00
ESP32/examples/DeepSleep/SmoothBlink_ULP_Code------------00
Ethernet/examples/ETH_LAN8720------------00

@lucasssvaz lucasssvaz added the Status: Review needed Issue or PR is awaiting review label Jun 27, 2025
@lucasssvaz lucasssvaz dismissed their stale review June 27, 2025 13:16

No need for changes

@lucasssvaz lucasssvaz added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Jun 30, 2025
@me-no-dev me-no-dev merged commit 6476260 into espressif:master Jun 30, 2025
158 of 187 checks passed
@MattiasTF MattiasTF deleted the fix-String branch June 30, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants