Skip to content

Commit 95b17c1

Browse files
OhadMeirNir-Az
authored andcommitted
Handle PR#15481 bot comments
1 parent bfdc3c0 commit 95b17c1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/linux/camera-identifier-v4l.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <src/librealsense-exception.h>
99

1010
#include <rsutils/number/crc32.h>
11+
#include <rsutils/string/from.h>
1112

1213
#include <sstream>
1314
#include <cstring>
@@ -38,7 +39,7 @@ namespace librealsense
3839
const uint8_t * gvd_struct = gvd.data() + GVD_OPCODE_HEADER;
3940
uint16_t payload_size = gvd_struct[D500_GVD_PAYLOAD_SIZE_OFFSET]
4041
| ( gvd_struct[D500_GVD_PAYLOAD_SIZE_OFFSET + 1] << 8 );
41-
if( GVD_OPCODE_HEADER + D500_GVD_HEADER_SIZE + payload_size > gvd.size() )
42+
if( payload_size == 0 || GVD_OPCODE_HEADER + D500_GVD_HEADER_SIZE + payload_size > gvd.size() )
4243
return false;
4344
uint32_t stored_crc;
4445
std::memcpy( &stored_crc, gvd_struct + D500_GVD_CRC32_OFFSET, sizeof( stored_crc ) );
@@ -76,8 +77,8 @@ namespace librealsense
7677
case GVD_PID_D415_GMSL: device_pid = D415_GMSL_PID; break;
7778
case GVD_PID_D401_GMSL: device_pid = D401_GMSL_PID; break;
7879
default:
79-
LOG_WARNING( "Unidentified MIPI device product id: 0x" << std::hex << (int)gvd[4 + GVD_PID_OFFSET] );
80-
break;
80+
throw linux_backend_exception( rsutils::string::from()
81+
<< "Unidentified MIPI device product id: 0x" << std::hex << (int)gvd[4 + GVD_PID_OFFSET] );
8182
}
8283

8384
_vid = 0x8086;

0 commit comments

Comments
 (0)