Commit 4235124d authored by Nathan Howell's avatar Nathan Howell Committed by Vijay Vasudevan
Browse files

ZlibInputBuffer::Inflate() incorrectly considers Z_STREAM_END an error (#3783)

When reading compressed records produced by something other than
TFRecordWriter it is possible to produce valid files that are not
readable by Tensorflow.

This fix adds a test that creates a deflate file using the builtin zlib
module that previously caused TFRecordReader to raise an exception:

`DataLossError: inflate() failed with error 1`

Full stack is below:

```
======================================================================
ERROR: testZLibFlushRecord (__main__.TFRecordWriterZlibTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/source/tensorflow/tensorflow/python/kernel_tests/reader_ops_test.py", line 495, in testZLibFlushRecord
    k, v = sess.run([key, value])
  File "/Users/nhowell/.virtualenvs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 710, in run
    run_metadata_ptr)
  File "/Users/nhowell/.virtualenvs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 908, in _run
    feed_dict_string, options, run_metadata)
  File "/Users/nhowell/.virtualenvs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 958, in _do_run
    target_list, options, run_metadata)
  File "/Users/nhowell/.virtualenvs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 978, in _do_call
    raise type(e)(node_def, op, message)
DataLossError: inflate() failed with error 1
	 [[Node: ReaderRead = ReaderRead[_class=["loc:@fifo_queue", "loc:@test_reader"], _device="/job:localhost/replica:0/task:0/cpu:0"](test_reader, fifo_queue)]]
```
parent 107416b8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment