fix: Segmentation fault in tink while writing data (#1490) · googleapis/python-storage@2a46c0b · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 2a46c0b

Browse files
authored
fix: Segmentation fault in tink while writing data (#1490)
* fix: Segmentation fault in tink while writing data * add unit tests
1 parent 4e9b714 commit 2a46c0b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

google/cloud/storage/_media/requests/download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ def _write_to_stream(self, response):
387387
msg += content_length_msg
388388
raise DataCorruption(response, msg)
389389

390-
391390
def consume(
392391
self,
393392
transport,

google/cloud/storage/fileio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def write(self, b):
477477
self._buffer.seek(0, io.SEEK_END)
478478
pos = self._buffer.write(b)
479479
self._buffer.seek(bookmark)
480-
return self._cursor + pos
480+
return pos
481481

482482
def read(self, size=-1):
483483
"""Read and move the cursor."""

tests/unit/test_fileio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,14 @@ def test_write(self, mock_warn):
367367

368368
# Write under chunk_size. This should be buffered and the upload not
369369
# initiated.
370-
writer.write(TEST_BINARY_DATA[0:4])
370+
w1 = writer.write(TEST_BINARY_DATA[0:4])
371+
self.assertEqual(w1, 4)
371372
blob._initiate_resumable_upload.assert_not_called()
372373

373374
# Write over chunk_size. This should result in upload initialization
374375
# and multiple chunks uploaded.
375-
writer.write(TEST_BINARY_DATA[4:32])
376+
w2 = writer.write(TEST_BINARY_DATA[4:32])
377+
self.assertEqual(w2, 28)
376378
blob._initiate_resumable_upload.assert_called_once_with(
377379
blob.bucket.client,
378380
writer._buffer,

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.