{"action":"created","issue":{"url":"https://api.github.com/repos/jpountz/lz4-java/issues/68","repository_url":"https://api.github.com/repos/jpountz/lz4-java","labels_url":"https://api.github.com/repos/jpountz/lz4-java/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/jpountz/lz4-java/issues/68/comments","events_url":"https://api.github.com/repos/jpountz/lz4-java/issues/68/events","html_url":"https://github.com/jpountz/lz4-java/issues/68","id":85097853,"number":68,"title":"Source ByteBuffer gets tampered on Decompressing","user":{"login":"vaibhavhajela","id":12747661,"avatar_url":"https://avatars.githubusercontent.com/u/12747661?v=3","gravatar_id":"","url":"https://api.github.com/users/vaibhavhajela","html_url":"https://github.com/vaibhavhajela","followers_url":"https://api.github.com/users/vaibhavhajela/followers","following_url":"https://api.github.com/users/vaibhavhajela/following{/other_user}","gists_url":"https://api.github.com/users/vaibhavhajela/gists{/gist_id}","starred_url":"https://api.github.com/users/vaibhavhajela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaibhavhajela/subscriptions","organizations_url":"https://api.github.com/users/vaibhavhajela/orgs","repos_url":"https://api.github.com/users/vaibhavhajela/repos","events_url":"https://api.github.com/users/vaibhavhajela/events{/privacy}","received_events_url":"https://api.github.com/users/vaibhavhajela/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2015-06-04T13:22:29Z","updated_at":"2016-10-26T01:44:51Z","closed_at":null,"body":"Hi Team,\r\nI am using LZ4 1.3.0 library to compress and decompress ByteBuffer. My sourcebuffer gets altered during decompression.\r\n//Compression \r\nint compressLen = compressor.compress(message, 0, decompressedLength, message, 0, maxCompressedLength);\r\n\r\n//Decompression\r\nint decompressed = deCompressor.decompress(msg, 0,compressedLen, bufferMsg, 0, bufferMsg.capacity());\r\n\r\nActually my source buffer contains many compressed messages separated by Identifiers and I am decompressing them one by one in loop.\r\nFirst decompression works fine, but from second decompression, I start  getting following error for all the subsequent messages \"Error decoding offset 422 of input buffer\".\r\n\r\nHowever if i use a Temporary buffer as source buffer to decompress, decompression works fine for all the compressed messages.\r\n//Decompression using tempBuffer\r\nSystem.arraycopy(msg.array(),msg.arrayOffset(), tempMsg.array(),tempMsg.arrayOffset(), compressedLen);\r\nint decompressed = deCompressor.decompress(tempMsg, 0,compressedLen , bufferMsg, 0, bufferMsg.capacity());\r\n\r\nIt seems to me that the SourceBuffer to be decompressed gets somehow modified on Decompression.\r\n\r\nCan anybody please help, How do i achive this decompression without using a temp Buffer.\r\n"},"comment":{"url":"https://api.github.com/repos/jpountz/lz4-java/issues/comments/256227482","html_url":"https://github.com/jpountz/lz4-java/issues/68#issuecomment-256227482","issue_url":"https://api.github.com/repos/jpountz/lz4-java/issues/68","id":256227482,"user":{"login":"lyrachord","id":11712923,"avatar_url":"https://avatars.githubusercontent.com/u/11712923?v=3","gravatar_id":"","url":"https://api.github.com/users/lyrachord","html_url":"https://github.com/lyrachord","followers_url":"https://api.github.com/users/lyrachord/followers","following_url":"https://api.github.com/users/lyrachord/following{/other_user}","gists_url":"https://api.github.com/users/lyrachord/gists{/gist_id}","starred_url":"https://api.github.com/users/lyrachord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyrachord/subscriptions","organizations_url":"https://api.github.com/users/lyrachord/orgs","repos_url":"https://api.github.com/users/lyrachord/repos","events_url":"https://api.github.com/users/lyrachord/events{/privacy}","received_events_url":"https://api.github.com/users/lyrachord/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T01:44:51Z","updated_at":"2016-10-26T01:44:51Z","body":"Hi @vaibhavhajela  check the generated files: build\\java\\net\\jpountz\\lz4\\LZ4JavaSafeFastDecompressor.java, of cause after the building.\r\nit's very clear about the lz4 sequence what you want.\r\nA simple description as follows:\r\nlz4compressed=[token][data][token][data]\r\ntoken=(RunLength,MatchLegth,Offset)=[half-half][run length byte....][short little endian offset][match length byte...]\r\nif RunLength or MatchLength<15(half byte) there is no  additional bytes followed\r\nThe additional bytes used while(x-=255) loop, that's 255*times+remainder, Indeed this part can be replaced with other shceme, such as varint.\r\n\r\nWhen decompressed sequence clear, then the compressor part is clear too.\r\n\r\n"}}
{"actor":{"display_login":"lyrachord"}}