Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libclamav/bytecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "builtin_bytecodes.h"

#ifndef MAX_TRACKED_BC
#define MAX_TRACKED_BC 64
#define MAX_TRACKED_BC (84 * 2) /* 84 is the number of signatures in the bytecode database as of 2026-04-15 */
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_TRACKED_BC is now tied to the current bytecode signature count (84) and annotated with a specific date, which will quickly become stale as the database changes. Consider switching to a fixed headroom constant (e.g., 168 or a round number like 256) with a comment that it must remain >= the number of bytecode signatures, relying on the existing #ifndef override for builds that want to tune it.

Suggested change
#define MAX_TRACKED_BC (84 * 2) /* 84 is the number of signatures in the bytecode database as of 2026-04-15 */
#define MAX_TRACKED_BC 256 /* Must remain >= the number of bytecode signatures; override at build time if needed. */

Copilot uses AI. Check for mistakes.
#endif
#define BC_EVENTS_PER_SIG 2
#define MAX_BC_SIGEVENT_ID MAX_TRACKED_BC *BC_EVENTS_PER_SIG
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_BC_SIGEVENT_ID is defined without parentheses, which can lead to unexpected precedence if it’s used in more complex expressions. Define it as a fully parenthesized macro (including parentheses around the whole expression and each operand) to make expansion safe.

Suggested change
#define MAX_BC_SIGEVENT_ID MAX_TRACKED_BC *BC_EVENTS_PER_SIG
#define MAX_BC_SIGEVENT_ID ((MAX_TRACKED_BC) * (BC_EVENTS_PER_SIG))

Copilot uses AI. Check for mistakes.
Expand Down
Loading