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

Fix #1443 - trim teaEncode trailing zeroes #1534

Merged
merged 5 commits into from
Jun 28, 2020

Conversation

Pirulax
Copy link
Contributor

@Pirulax Pirulax commented Jun 22, 2020

So basically, with the introduction of sbx's new parser, we started returning strings with lua_pushlstring, which takes a length as an argument, thus pushes the whole string along with padding. The old method used lua_pushstring which used strlen, thus god rid of the padding.
This PR fixes #1443 .

Edit: test resource: utf1443.zip

qaisjp
qaisjp previously requested changes Jun 22, 2020
Shared/sdk/SharedUtil.Hash.hpp Outdated Show resolved Hide resolved
Shared/sdk/SharedUtil.Hash.hpp Outdated Show resolved Hide resolved
@qaisjp qaisjp requested a review from sbx320 June 22, 2020 15:20
@qaisjp qaisjp changed the title Fix #1443 - trim teaEncode block padding(0's) at the end Fix #1443 - trim teaEncode block trailing zeroes Jun 22, 2020
@qaisjp qaisjp changed the title Fix #1443 - trim teaEncode block trailing zeroes Fix #1443 - trim teaEncode trailing zeroes Jun 22, 2020
@qaisjp qaisjp added this to the 1.5.8 milestone Jun 22, 2020
Shared/sdk/SharedUtil.Hash.hpp Outdated Show resolved Hide resolved
@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 22, 2020

I can't connect to my 1.5.6 server, for some stupid reason(a resource sets min client version, and I cant figure out which one)

Please, could someone run a few tests, and post the results here on 1.5.6 server and client?

Test values:

  • 123
  • 1234
  • \0\0Hello
  • 123\0
  • hithere\0\0\0\0
  • \0hi\0
  • \0\0\0\0\0hi\0\0
  • 123\0\0\0\0

They key can be anything. Let it be.. "c++20"

@ccw808
Copy link
Member

ccw808 commented Jun 22, 2020

@Pirulax mtaserver.conf:

    <minclientversion></minclientversion>
    <minclientversion_auto_update>0</minclientversion_auto_update>

Edit: Oh a resource sets it - Nevermind

@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 23, 2020

btw, the problem is that, now I've fixed en/decodeString as well, which has been returning wrong values since it was introduced. Should we keep backwards compatibility? Or just hope nobody tries comparing decoded strings?

@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 23, 2020

Btw, since the old one used strnlen it strips all padding from the end, so I'll modify this one to be like that.

@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 23, 2020

@Pirulax mtaserver.conf:

    <minclientversion></minclientversion>
    <minclientversion_auto_update>0</minclientversion_auto_update>

Edit: Oh a resource sets it - Nevermind

Actually, I'm not sure if it was a resource. I think this'll help, thanks!

@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 23, 2020

New resource to test: utf1443.zip

@StrixG StrixG added the bug Something isn't working label Jun 23, 2020
@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 26, 2020

We need to fix the padding in teaEncode, because with binary files 0's at the file end is totally acceptable.

@Pirulax
Copy link
Contributor Author

Pirulax commented Jun 27, 2020

Perhaps, maybe add a noTrim argument?

@qaisjp qaisjp dismissed their stale review June 27, 2020 20:46

Changes addressed

@qaisjp
Copy link
Contributor

qaisjp commented Jun 27, 2020

Lets try and fix the regression in this PR and we can discuss other problems with teaEncode in a separate issue.

@ccw808
Copy link
Member

ccw808 commented Jun 27, 2020

Lets try and fix the regression in this PR and we can discuss other problems with teaEncode in a separate issue.

Agreed. Let's get this fixed yesterday

@ccw808 ccw808 merged commit 767a41c into multitheftauto:master Jun 28, 2020
@Pirulax Pirulax deleted the hotfix/1443 branch June 28, 2020 10:33
StrixG added a commit that referenced this pull request Aug 17, 2020
ccw808 pushed a commit that referenced this pull request Aug 17, 2020
@Pirulax Pirulax restored the hotfix/1443 branch October 2, 2020 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tea encoding bug
5 participants