소스 검색

LibGfx: Load correct durations for gifs

The wrong shift effectively set the upper byte to 0, meaning that
durations longer than 255 centiseconds (2.55 seconds) were wrapped
around. See serenity-fuzz-corpora for an example.
Ben Wiederhake 4 년 전
부모
커밋
a49c77b76d
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Userland/Libraries/LibGfx/GIFLoader.cpp

+ 1 - 1
Userland/Libraries/LibGfx/GIFLoader.cpp

@@ -511,7 +511,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
                 u8 transparent = sub_block[0] & 1;
                 current_image->transparent = transparent == 1;
 
-                u16 duration = sub_block[1] + ((u16)sub_block[2] >> 8);
+                u16 duration = sub_block[1] + ((u16)sub_block[2] << 8);
                 current_image->duration = duration;
 
                 current_image->transparency_index = sub_block[3];