ValidateBitmapInfoHeader

 
Microsoft DirectShow 9.0

ValidateBitmapInfoHeader

The ValidateBitmapInfoHeader function checks a BITMAPINFOHEADER structure for certain common errors that can cause buffer overruns or integer overflows.

  • Note   This function does not guarantee that the BITMAPINFOHEADER structure is valid or that code using the structure is secure.

Syntax

  inline BOOL ValidateBitmapInfoHeader(
    const BITMAPINFOHEADER *
  pbmi,
    DWORD cbSize
);

Parameters

pbmi

Pointer to the BITMAPINFOHEADER structure to validate.

cbSize

Size of the memory block that holds the structure, in bytes.

Return Value

Returns a Boolean value. If the value is FALSE, the BITMAPINFOHEADER structure is not valid.

Remarks

This function guards against the following errors:

  • Arithmetic overflow in the structure size or an invalid structure size.
  • Invalid value for the biClrUsed member.
  • Arithmetic overflow in the image size (biSizeImage).
  • Invalid values for the image size (biSizeImage) for RGB formats.

The function does not check whether the structure describes a valid video format.

Requirements

**  Header:** Include checkbmi.h.

**  Library:** None.

See Also