visual c++ - C++: Check if bmp file is legit -


I am using C ++ (Visual Studio) and I have to check that any .bmp file is legal ( Some names do not change by changing the virus .xa) before the user can share it with other users on the Internet using their application. I am using DirectX 2D rendering and boost framework.

Is Any Bitmap Valid?

Thank you.

You can try to load a bitmap with Windows LoadImage , Which must be unsuccessful for the faulty bitmap.

As others have mentioned, you can check the bitmap header and sanitary like file size (depending on what you find in the header). It will be faster than LoadImage , but there are many legal variations of the bitmap header for writing and testing.

Probably, LoadImage is well tested because it has been forever.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -