fix: bitstream_index_map overflow

This commit is contained in:
douniwan5788 2024-08-30 16:04:07 +08:00
commit 0710a37429
4 changed files with 7 additions and 5 deletions

View file

@ -222,11 +222,11 @@ static int get_from_fpga_combined_stream(lz4_streamp_t compressed_fpga_stream, u
}
static int bitstream_target_to_index(FPGA_config bitstream_target) {
static int8_t bitstream_index_map[FPGA_BITSTREAM_MAX] = {-1};
static int8_t bitstream_index_map[FPGA_CONFIG_COUNT] = {-1};
// Initialize
if (bitstream_index_map[0] == -1) {
bitstream_index_map[0] = 0;
if (bitstream_index_map[FPGA_BITSTREAM_UNKNOWN] == -1) {
bitstream_index_map[FPGA_BITSTREAM_UNKNOWN] = 0;
for (size_t i = 0; i < g_fpga_bitstream_num; i++) {
FPGA_VERSION_INFORMATION info = g_fpga_version_information[i];