adafruit / Adafruit_TinyUSB_ArduinoCore

TinyUSB Core for Arduino
MIT License
21 stars 22 forks source link

Use of uninitialized variable #8

Closed henrygab closed 4 years ago

henrygab commented 4 years ago

Compiler error:

...\cores\nRF5\TinyUSB\Adafruit_TinyUSB_ArduinoCore\Adafruit_USBD_Device.cpp:
    In function 'int strcpy_utf16(const char*, uint16_t*, int)':
...\cores\nRF5\TinyUSB\Adafruit_TinyUSB_ArduinoCore\Adafruit_USBD_Device.cpp:294:17:
    warning: 'codepoint' may be used uninitialized in this function [-Wmaybe-uninitialized]
       codepoint -= 0x10000;
       ~~~~~~~~~~^~~~~~~~~~

This is caused by the variable 'codepoint' not being initialized in the error path.

https://github.com/adafruit/Adafruit_TinyUSB_ArduinoCore/blob/57244c13a72583c1b5a7f1e16cd8358c79d9e335/Adafruit_USBD_Device.cpp#L213-L231