{"action":"closed","issue":{"url":"https://api.github.com/repos/google/brotli/issues/141","labels_url":"https://api.github.com/repos/google/brotli/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/google/brotli/issues/141/comments","events_url":"https://api.github.com/repos/google/brotli/issues/141/events","html_url":"https://github.com/google/brotli/issues/141","id":102742738,"number":141,"title":"Decompression failures with uncompressable data","user":{"login":"nemequ","id":1151,"avatar_url":"https://avatars.githubusercontent.com/u/1151?v=3","gravatar_id":"","url":"https://api.github.com/users/nemequ","html_url":"https://github.com/nemequ","followers_url":"https://api.github.com/users/nemequ/followers","following_url":"https://api.github.com/users/nemequ/following{/other_user}","gists_url":"https://api.github.com/users/nemequ/gists{/gist_id}","starred_url":"https://api.github.com/users/nemequ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemequ/subscriptions","organizations_url":"https://api.github.com/users/nemequ/orgs","repos_url":"https://api.github.com/users/nemequ/repos","events_url":"https://api.github.com/users/nemequ/events{/privacy}","received_events_url":"https://api.github.com/users/nemequ/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-24T08:59:25Z","updated_at":"2015-09-01T13:05:36Z","closed_at":"2015-09-01T13:05:36Z","body":"Seems to happen with data with a length of a power of two >= 32.  8 and 16 work, 32, 64, 128, and 256 don't.  Test case:\r\n\r\n```cpp\r\n#include <stdint.h>\r\n#include <assert.h>\r\n\r\n#include \"enc/encode.h\"\r\n#include \"dec/decode.h\"\r\n\r\nconst uint8_t uncompressed[] = {\r\n  0x01, 0x4a, 0x2d, 0x82, 0x59, 0x2f, 0xdd, 0xe6,\r\n  0x4f, 0x69, 0x6c, 0x70, 0x13, 0x87, 0x9f, 0xe4,\r\n  0xd3, 0xb1, 0x9a, 0x86, 0xeb, 0x31, 0xa9, 0x69,\r\n  0x1d, 0x2b, 0x22, 0x60, 0x38, 0xaf, 0xb2, 0x27,\r\n  0xee, 0x48, 0x9e, 0x67, 0x3d, 0x5f,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, 0x43, 0x49,\r\n  0xe2, 0xcc, 0x98, 0x8d, 0x14, 0x2b, 0x17, 0xc2,\r\n  0x1b, 0xd3, 0x03, 0x13, 0x8d, 0x72, 0x76, 0x96,\r\n  0xce, 0x23, 0x93, 0xee, 0x30, 0x7a, 0xe3, 0x74,\r\n  0xb6, 0x28, 0xc4, 0xfc, 0xb6, 0x3e, 0xf9, 0xe0,\r\n  0x9a, 0x88, 0x86, 0x5b, 0xfc, 0xc0, 0x0b, 0xdf,\r\n  0xa4, 0xfb, 0x79, 0x0f, 0x95, 0x12, 0xaf, 0x43\r\n};\r\n\r\nint main(int argc, char *argv[]) {\r\n  uint8_t compressed[sizeof(uncompressed) + 4];\r\n  size_t compressed_length = sizeof(compressed);\r\n  uint8_t decompressed[sizeof(uncompressed)];\r\n  size_t decompressed_length = sizeof(decompressed);\r\n\r\n  {\r\n    int result;\r\n    brotli::BrotliParams params;\r\n    params.quality = 11;\r\n    params.mode = brotli::BrotliParams::MODE_GENERIC;\r\n    params.enable_transforms = false;\r\n\r\n    result = brotli::BrotliCompressBuffer (params,\r\n\t\t\t\t\t   sizeof(uncompressed), uncompressed,\r\n\t\t\t\t\t   &compressed_length, compressed);\r\n\r\n    assert (result == 1);\r\n\r\n    fprintf (stderr, \"Compressed %zu bytes to %zu bytes\\n\", sizeof(uncompressed), compressed_length);\r\n  }\r\n\r\n  {\r\n    BrotliResult result;\r\n\r\n    result = BrotliDecompressBuffer (compressed_length, compressed,\r\n\t\t\t\t     &decompressed_length, decompressed);\r\n\r\n    assert (result == BROTLI_RESULT_SUCCESS);\r\n\r\n    fprintf (stderr, \"Decompressed %zu bytes to %zu bytes\\n\", compressed_length, decompressed_length);\r\n  }\r\n\r\n  return 0;\r\n}\r\n```"}}