Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZLibDecoder/ZLibEncoder: corruped data #30656

Open
alsemenov opened this issue Sep 8, 2017 · 1 comment
Open

ZLibDecoder/ZLibEncoder: corruped data #30656

alsemenov opened this issue Sep 8, 2017 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-documentation A request to add or improve documentation

Comments

@alsemenov
Copy link
Contributor

ZLibEncoder is intended to compress data.
ZLibDecoder is intended to decompress compressed data.

The following example demonstrates the problem:

import "dart:io";

main() {
  List<int> data1 = new List.generate(260, (int i) => i); // anything greater than 256 is ok
  List<int> data2 = new ZLibDecoder().convert(new ZLibEncoder().convert(data1));
  if (data1.length!=data2.length){
    print("data1.length: ${data1.length} data2.length: ${data2.length}");
  }
  for (int i=0; i<data1.length; i++){
    if (data1[i]!=data2[i]){
      print("mismatch at index $i: source: ${data1[i]} decoded: ${data2[i]}");
    }
  }
}

Output:

mismatch at index 256: source: 256 decoded: 0
mismatch at index 257: source: 257 decoded: 1
mismatch at index 258: source: 258 decoded: 2
mismatch at index 259: source: 259 decoded: 3

Dart VM version: 1.24.2 (Thu Jun 22 08:55:56 2017) on "windows_x64"

@lrhn
Copy link
Member

lrhn commented Sep 8, 2017

Input integers must be bytes (0..255). We need to document what happens if they are not.

@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-documentation A request to add or improve documentation labels Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io type-documentation A request to add or improve documentation
Projects
None yet
Development

No branches or pull requests

2 participants