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

使用git提交时报短读错误 #49

Open
DoubleK6 opened this issue Nov 2, 2022 · 4 comments
Open

使用git提交时报短读错误 #49

DoubleK6 opened this issue Nov 2, 2022 · 4 comments

Comments

@DoubleK6
Copy link

DoubleK6 commented Nov 2, 2022

将一个加密文件(txt类型)提交时,运行git add命令时会报短读错误,猜测是git先检查的文件大小与添加时明文大小不一致引起的

@DoubleK6
Copy link
Author

读操作预处理回调中缓冲读取时 Data->Iopb->Parameters.Read.Length = (ULONG)(StreamContext->FileSize - StartingVbo)
虽然设置了length,但是在后处理回调中,缓冲读取中的length仍然没有改变,导致了git的短读错误;

如果在后处理回调中
if (FALSE==NonCachedIo) { Data->IoStatus.Information = Data->Iopb->Parameters.Read.Length; }
虽然没有短读,但是git也把缓冲中Filesize之外的数据添加了进去,(期望是只提交明文,或者附带的是加密尾,而不是杂乱数据)

@DoubleK6
Copy link
Author

记录一下:preread中的cachio读取,修改length,虽然在postread中看到的length没有改变,但是实际读取的内容长度确实是按修改后的length长度,Data->IoStatus.Information 操作的字节也是实际操作的字节,但是git做了返回值检查,所以又回到了原始问题

@DoubleK6
Copy link
Author

DoubleK6 commented Dec 19, 2022

使用自己编译的debug版本的git时,进行gdb单步调试,发现没有问题,很奇怪 git版本2.33.1.windows.1

@hkx3upper
Copy link
Owner

hkx3upper commented Dec 24, 2022

最近不搞这块了,我爱上班!
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants