Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

[BUG-226952] Not all bitmaps formats are supported by LLImageBMP #5386

Open
sl-service-account opened this issue May 7, 2019 · 1 comment

Comments

@sl-service-account
Copy link

What just happened?

Wrong condition ( 12 <= header.mSize && 64 <= header.mSize ) causes mistakenly bypass of next BITMAPV4HEADER and BITMAPV5HEADER formats inside LLImageBMP::updateData() :


	if( 12 == header.mSize )
	{
		setLastError("Windows 2.x and OS/2 1.x BMP files are not supported");
		return false;
	}
	else
	if( 40 == header.mSize )
	{
		if( 3 == header.mCompression )
		{
			// Windows NT
			windows_nt_version = true;
		}
		else
		{
			// Windows 3.x
		}
	}
	else
	if( 12 <= header.mSize && 64 <= header.mSize )
	{
		setLastError("OS/2 2.x BMP files are not supported");
		return false;
	}
	else
	if( 108 == header.mSize )
	{
		// BITMAPV4HEADER
		windows_95_version = true;
	}
	else
	if( 108 < header.mSize )
	{
		// BITMAPV5HEADER or greater
		// Should work as long at Microsoft maintained backwards compatibility (which they did in V4 and V5)
		windows_95_version = true;
	}

I suggest to fix it with ( 12 <= header.mSize && header.mSize <= 64 ).

What were you doing when it happened?

Checking code.

What were you expecting to happen instead?

No bug.

Other information

https://jira.phoenixviewer.com/browse/FIRE-23080

Original Jira Fields
Field Value
Issue BUG-226952
Summary Not all bitmaps formats are supported by LLImageBMP
Type Bug
Priority Unset
Status Accepted
Resolution Accepted
Reporter Ryo Pasternak (ryo.pasternak)
Created at 2019-05-07T03:39:29Z
Updated at 2019-05-09T16:59:46Z
{
  'Build Id': 'unset',
  'Business Unit': ['Platform'],
  'Date of First Response': '2019-05-09T11:59:46.618-0500',
  "Is there anything you'd like to add?": 'https://jira.phoenixviewer.com/browse/FIRE-23080',
  'ReOpened Count': 0.0,
  'Severity': 'Unset',
  'System': 'SL Viewer',
  'Target Viewer Version': 'viewer-development',
  'What just happened?': 'Wrong condition ( 12 <= header.mSize && 64 <= header.mSize ) causes mistakenly bypass of next BITMAPV4HEADER and BITMAPV5HEADER formats inside LLImageBMP::updateData() :\r\n{code:none}\r\n\tif( 12 == header.mSize )\r\n\t{\r\n\t\tsetLastError("Windows 2.x and OS/2 1.x BMP files are not supported");\r\n\t\treturn false;\r\n\t}\r\n\telse\r\n\tif( 40 == header.mSize )\r\n\t{\r\n\t\tif( 3 == header.mCompression )\r\n\t\t{\r\n\t\t\t// Windows NT\r\n\t\t\twindows_nt_version = true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Windows 3.x\r\n\t\t}\r\n\t}\r\n\telse\r\n\tif( 12 <= header.mSize && 64 <= header.mSize )\r\n\t{\r\n\t\tsetLastError("OS/2 2.x BMP files are not supported");\r\n\t\treturn false;\r\n\t}\r\n\telse\r\n\tif( 108 == header.mSize )\r\n\t{\r\n\t\t// BITMAPV4HEADER\r\n\t\twindows_95_version = true;\r\n\t}\r\n\telse\r\n\tif( 108 < header.mSize )\r\n\t{\r\n\t\t// BITMAPV5HEADER or greater\r\n\t\t// Should work as long at Microsoft maintained backwards compatibility (which they did in V4 and V5)\r\n\t\twindows_95_version = true;\r\n\t}\r\n{code}\r\nI suggest to fix it with ( 12 <= header.mSize && header.mSize <= 64 ).',
  'What were you doing when it happened?': 'Checking code.',
  'What were you expecting to happen instead?': 'No bug.',
}
@sl-service-account
Copy link
Author

Kyle Linden commented at 2019-05-09T16:59:47Z

Hi Ryo,

Thanks for the report!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant