1syntax = "proto2"; 2// Proto description of the gif format. 3// Refer to: https://www.fileformat.info/format/gif/egff.htm 4// https://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp 5 6// TODO: Verify if this is correct 7 8message LogicalScreenDescriptor { 9 required uint32 ScreenWidth = 1; 10 required uint32 ScreenHeight= 2; 11 required uint32 Packed = 3; 12 required uint32 BackgroundColor = 4; 13 required uint32 AspectRatio = 5; 14} 15 16message GlobalColorTable { 17 required bytes colors = 1; 18} 19 20message ImageDescriptor { 21 required uint32 Seperator =1; 22 required uint32 Left =2; 23 required uint32 Top = 3; 24 required uint32 Width = 4; 25 required uint32 Height = 5; 26 required uint32 Packed = 6; 27} 28 29message GraphicControlExtension { 30 required uint32 Packed = 1; 31 required uint32 DelayTime = 2; 32 required uint32 transparentColorIndex = 3; 33} 34 35message PlainTextExtension { 36 repeated SubBlock subs = 1; 37 optional GraphicControlExtension gcExt = 2; 38} 39 40message LocalColorTable { 41 required bytes colors = 1; 42} 43 44message SubBlock { 45 required uint32 len = 1; 46 required bytes data = 2; 47} 48 49message ImageData { 50 required uint32 lzw = 1; 51 repeated SubBlock subs = 2; 52} 53 54message BasicChunk { 55 required ImageDescriptor imDescriptor =1; 56 required LocalColorTable lct = 2; 57 required ImageData img = 3; 58 optional GraphicControlExtension gcExt = 4; 59} 60 61message ApplicationExtension { 62 required fixed64 appid = 1; 63 repeated SubBlock subs = 2; 64} 65 66message CommentExtension { 67 repeated SubBlock subs = 1; 68} 69 70message Header { 71 enum Version { 72 ENA = 1; 73 ESA = 2; 74 INV = 3; 75 } 76 required Version ver = 1; 77} 78 79message Trailer {} 80 81message ImageChunk { 82 oneof chunk_oneof { 83 BasicChunk basic = 1; 84 PlainTextExtension plaintext = 2; 85 ApplicationExtension appExt = 3; 86 CommentExtension comExt = 4; 87 } 88} 89 90message GifProto { 91 required Header header = 1; 92 required LogicalScreenDescriptor lsd = 2; 93 // Instead of making GCT optional here, we condition its visit on LSD's packed byte 94 // in the converter 95 required GlobalColorTable gct = 3; 96 repeated ImageChunk chunks = 4; 97 required Trailer trailer = 5; 98} 99 100package gifProtoFuzzer;