AnsweredAssumed Answered

Bug reporting: USB CDC: Using non-initialized dynamic memory

Question asked by Greg Moroz on Feb 25, 2018
Latest reply on Feb 26, 2018 by Greg Moroz


Device: STM32F407VGT



PC part:

OS: Windows 10

Driver: USB Serial Device, Microsoft, 6/21/2006, v10.0.16299.15


Initialization code is generated using the STM32CubeMX Version 4.24.0 with STM32Cube_FW_F4_V1.19.0.


Attached are already pre-built initially generated project with CubeMX (initial.7z) and fixed project (fixed.7z). The .ioc files are included to the projects.

When running initial.7z it acts normally until the port opening trial. Port opening fails.

The fixed.7z has no such behavior and is running good so far.


The key line which is different for two projects:

USBD_memset(pdev->pClassData, 0x00, sizeof (USBD_CDC_HandleTypeDef));


Up to you to decide whether the problem is caused by non-initialized memory usage or by dynamic memory usage in principle.


I can describe more why I'm sure the bug is here. Please let me know if more evidences are needed.