Change in pysim[master]: commands: return none, when offset exceeds file length

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Fri Nov 5 16:55:48 UTC 2021


dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/26083 )

Change subject: commands: return none, when offset exceeds file length
......................................................................

commands: return none, when offset exceeds file length

The computed length of the file may be negative, when the offset exceeds
the file length. When this is the case, return none

Change-Id: I2c017c620254fae188022851ef3b670730aab503
---
M pySim/commands.py
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/pySim/commands.py b/pySim/commands.py
index 107f0f5..cea330e 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -155,6 +155,9 @@
 			return (None, None)
 		if length is None:
 			length = self.__len(r) - offset
+		if length < 0:
+			return (None, None)
+
 		total_data = ''
 		chunk_offset = 0
 		while chunk_offset < length:

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/26083
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I2c017c620254fae188022851ef3b670730aab503
Gerrit-Change-Number: 26083
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211105/0bbadff4/attachment.htm>


More information about the gerrit-log mailing list