Skip to content

Commit 2760424

Browse files
Add files via upload
1 parent 5532d51 commit 2760424

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

pyfoxfile.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9715,6 +9715,7 @@ def FoxFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
97159715
return False
97169716
if(formdel != formatspecs['format_delimiter']):
97179717
return False
9718+
headeroffset = fp.tell()
97189719
if(__use_new_style__):
97199720
inheader = ReadFileHeaderDataBySize(fp, formatspecs['format_delimiter'])
97209721
else:
@@ -9733,24 +9734,9 @@ def FoxFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
97339734
fjsonsize = int(inheader[10], 16)
97349735
fjsonchecksumtype = inheader[11]
97359736
fjsonchecksum = inheader[12]
9737+
headerjsonoffset = fp.tell()
97369738
fprejsoncontent = fp.read(fjsonsize)
97379739
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs, saltkey)
9738-
if(fjsonsize > 0):
9739-
if(CheckChecksums(jsonfcs, fjsonchecksum)):
9740-
if(verbose):
9741-
VerbosePrintOut("File JSON Data Checksum Passed at offset " + str(outfjstart))
9742-
VerbosePrintOut("'" + outfjsonchecksum + "' == " + "'" + injsonfcs + "'")
9743-
else:
9744-
valid_archive = False
9745-
invalid_archive = True
9746-
if(verbose):
9747-
VerbosePrintOut("File JSON Data Checksum Error at offset " + str(outfjstart))
9748-
VerbosePrintOut("'" + outfjsonchecksum + "' != " + "'" + injsonfcs + "'")
9749-
if(not CheckChecksums(fjsonchecksum, jsonfcs) and not skipchecksum):
9750-
VerbosePrintOut("File JSON Data Checksum Error with file " +
9751-
fname + " at offset " + str(fheaderstart))
9752-
VerbosePrintOut("'" + fjsonchecksum + "' != " + "'" + jsonfcs + "'")
9753-
return False
97549740
# Next seek directive
97559741
if(re.findall(r"^\+([0-9]+)", outfseeknextfile)):
97569742
fseeknextasnum = int(outfseeknextfile.replace("+", ""))
@@ -9787,15 +9773,26 @@ def FoxFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
97879773
VerbosePrintOut("Number of Records " + str(fnumfiles))
97889774
if(headercheck):
97899775
if(verbose):
9790-
VerbosePrintOut("File Header Checksum Passed at offset " + str(0))
9776+
VerbosePrintOut("File Header Checksum Passed at offset " + str(headeroffset))
97919777
VerbosePrintOut("'" + fprechecksum + "' == " + "'" + newfcs + "'")
97929778
else:
97939779
# always flip flags, even when not verbose
97949780
valid_archive = False
97959781
invalid_archive = True
97969782
if(verbose):
9797-
VerbosePrintOut("File Header Checksum Failed at offset " + str(0))
9783+
VerbosePrintOut("File Header Checksum Failed at offset " + str(headeroffset))
97989784
VerbosePrintOut("'" + fprechecksum + "' != " + "'" + newfcs + "'")
9785+
if(fjsonsize > 0):
9786+
if(CheckChecksums(jsonfcs, fjsonchecksum)):
9787+
if(verbose):
9788+
VerbosePrintOut("File JSON Data Checksum Passed at offset " + str(headerjsonoffset))
9789+
VerbosePrintOut("'" + outfjsonchecksum + "' == " + "'" + injsonfcs + "'")
9790+
else:
9791+
valid_archive = False
9792+
invalid_archive = True
9793+
if(verbose):
9794+
VerbosePrintOut("File JSON Data Checksum Error at offset " + str(headerjsonoffset))
9795+
VerbosePrintOut("'" + outfjsonchecksum + "' != " + "'" + injsonfcs + "'")
97999796
if(verbose):
98009797
VerbosePrintOut("")
98019798
# Iterate either until EOF (seektoend) or fixed count

0 commit comments

Comments
 (0)