mirror of
https://github.com/imgproxy/imgproxy.git
synced 2026-06-18 17:43:40 +02:00
Adds handling of negative height value for bmp files. (#644)
* Adds handling of negative height value for bmp files. * Simplifies negative height check, and moves it down to include checking the OS/2 16-bit version. * Adds int16 conversion to OS/2 height.
This commit is contained in:
+7
-2
@@ -29,11 +29,16 @@ func DecodeBmpMeta(r io.Reader) (Meta, error) {
|
||||
|
||||
if infoSize >= 40 {
|
||||
width = int(binary.LittleEndian.Uint32(tmp[18:22]))
|
||||
height = int(binary.LittleEndian.Uint32(tmp[22:26]))
|
||||
height = int(int32(binary.LittleEndian.Uint32(tmp[22:26])))
|
||||
} else {
|
||||
// CORE
|
||||
width = int(binary.LittleEndian.Uint16(tmp[18:20]))
|
||||
height = int(binary.LittleEndian.Uint16(tmp[20:22]))
|
||||
height = int(int16(binary.LittleEndian.Uint16(tmp[20:22])))
|
||||
}
|
||||
|
||||
// height can be negative in Windows bitmaps
|
||||
if height < 0 {
|
||||
height = -height
|
||||
}
|
||||
|
||||
return &meta{
|
||||
|
||||
Reference in New Issue
Block a user