|
Do you see what is wrong with the Base64 encoded data (below)?*
*Find answer at bottom of this entry.
Also, don't try decoding the data because it is non-sense because it is base64 of encrypted data.
Had a problem where my Base64 data (all of a sudden) was being corrupted.
However, it is very subtle (see ANSWER at bottom). HINT: Just one char was being corrupted.
Data Only Corrupted After Posting
I couldn't understand this. The data (before I posted it was completely fine).
Only after posting data did it get corrupted (and it's not a URL-encoding thing).
Actually, that is incorrect. The data is posted to the web site & saved in DB with no corruption.
Only after the data is returned as a part of a JSON object is the base64 data corrupted. CRazy!!
I Finally Found This Argument At Github - Spoiler ALERT!!
+ sign is changing into \u002B using JsonSerializer.Serialize · Issue #35281 · dotnet/runtime · GitHub[^]
This is a very WEIRD (and obscure) thing. I can't believe I finally figured this out. Now, I will have to implement a fix. Discovering the problem was extremely difficult because the base64 data is upwards of 40K.
Have any of you seen this?
jHx4uha8sCRyiqv8nRVJpRoQPx45ghciXg6PJb8qrxORwmMTN6cLlDIh4PVZenZvh3saEtlGAxZlI2Wm\u002BumDIiIs/r9vU5XgnMMF\u002Bk5TnvzNSLvYaTY41mS4FNZ8yshdVFn\u002Bq2UolJzz8ldlycDW1a7JfWKS88XNaBVgbZYjrSquDjCHOwIY8yGzxHnv70BDHEgHz6IUtZ7gEzKQ/dlVabYe7D2/QfU0Mtobx/LVkxa/oiujTaoiCLIQdkmALGbQqj/rtdLlOzKWjqLMpa/EhwGTA5unrEJMR\u002BDgKIJ5kxwoffKwVeydXlz1GY9WcyJrFf1xJr2CmKhUsbbXQQ0Qcgi80FJcupEQr\u002Bd4jclGeVbyFla40Ncm7ZjDeRVQ5coP2n1VyHTosWpvk7WqDIv1URbD8Xx3qfrXr2LsbS\u002Bzhe67bXNv4wekJfkvfxY8dh4Qjz9ZW0PBwIgW6KdtmCEKsURRWl5m8OvLxkL8iWuXwG\u002BdQeTSJb0Ew/AohuSpuiSeV5REkEagMoGnHdV6sLGo8kselY4sh1SqtIdoRq5E6nO60V7kzcCfm4MgdmwWEuRRxtJeeEl59dDvvOOOefbYCHLWGONVQ4/hpLPxnU2beyPoz7j9oWz2hIMgjTlQgzupzIZzjdzu7O62PDRorm8rVnZAmLFnNbAmFCzpgLsB1HZrTL5/MXeEdUz2WuKjJPAi4q\u002BnPddo0xm6bkvKXoGWJbwFAoxaWD7hffcvuurAkIqPH2S8CgP3cmnLiM6Qg65k7Sy51T81ab92g92rBJ\u002B8BFVPCDVdGsy6BblFP2/KQ6\u002BoCllRD\u002BIqNqIfdfzmJUp2WEEpviwP\u002B9IhGuGC2flCrMclKaAmTuZLyijgQkC2\u002BEb7hU5GoA8h5ic3hOFSOhmUo20/LIiIIj3jUanfxJLLW6MTY3c5WNJlNUz0ucwGRUNqO2VMxsPnWp05M3aGU4kxYIracZwmvqeQKgGX59vhPo5GhmFxZroVkSO7\u002BEOWRG/J1et/5dFslN3dZDLFSIBvrA5pJF7BuEZPsbcWTOWxnrWZl\u002BeGouVoC8KfEfsCgZkbBKB1bR2ark7vZl6aEP1OrjuNonHGODutBaogq6V39T/4w86gz2Ow3qDfbGJh2nqJbE2JTNUbN/UbsEmKfdz7JC2jDjTZ7M3Cl0LXsLZM67\u002BFYZxvBzyKUsjXV3S1eHqLrk/i98yWs9YbSEHurIb7wggOac3MlzLz\u002BYCye2UAQxVE6vt66cv3wXBXLLlfwy3rBNVqSLv60
ANSWER
If you guessed that the \u002B should actually be a + character, you are amazing!!
|
|
|
|
|
Roger,
I'm sure that you've figured this out by now. That escaping behavior is actually in the JSON specification.
RFC 8259 - Section 7[^]
|
|
|
|
|
Yeah, it seems like it is a normal thing. It seems that it was just altering a test I had (that didn't parse it as json) that used the base64 encoded data and that is where I was seeing the issue.
It's part of a larger challenge so it looks like it was a false-positive for me.
Thanks
|
|
|
|
|
Gads, I remember dealing with a similar issue. Turned out the issue was that the front-end wasn't using encodeURIComponent in the utility app for setting password.
|
|
|
|
|
Public Shared Function GetAssemblyVersion() As String
Dim version() As String = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split("."c)
Return version(0) & "." & version(1) & "." & version(2) & "." & version(3)
End Function
Dijkstra was right...
|
|
|
|
|
anything special? sorry I am not good at VB...
diligent hands rule....
|
|
|
|
|
It would be almost the same in C#. He could have already gotten everything at Assembly.GetExecutingAssembly().GetName().Version, but he continued to get a string and split it, as any VB6 programmer would prefer. And then, in the next line, he joined the strings with the same character on which he split them, meaning he already had the same result on ToString().
|
|
|
|
|
thanks for explaining it to me
diligent hands rule....
|
|
|
|
|
Saša Ćetković wrote: as any VB6 programmer would prefer
Remind me why. I have not touched VB6 since 2008.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I noticed a pattern that they really like string manipulation - using magic strings, concatenating HTML as strings in ASP Classic, concatenating SQL...
|
|
|
|
|
For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:
Quote: The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.
|
|
|
|
|
I believe SQL Server has a maximum query memory of 2 gigs. You obviously surpassed that with all the unions. I believe all unions are read into memory.
I am guessing here, I could be wrong.
|
|
|
|
|
|
There are also only 100 levels of recursion in a cursor. Found that out in the poast two weeks when a client's process failed on a stored procedure that was last edited a decade ago.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Or a recursive CTE, but you can increase that I think.
|
|
|
|
|
I never make a large JOIN , I split it up:
A JOIN B JOIN C JOIN D
becomes:
( ( A JOIN B ) JOIN C ) JOIN D
|
|
|
|
|
Oh that's interesting! I'll have to try that!
|
|
|
|
|
For inner joins the optimizer will disregard any order of the joins, or any parentheses for that matter.
If you want to force a specific order there's a hint for that: OPTION (FORCE ORDER)
For outer joins this is not the case, they will happen in the relative order specified.
|
|
|
|
|
Question for you?
Can you verify this 1) uses less memory and/or 2) improves performance time?
Thanks! Craig
|
|
|
|
|
It has significantly reduced execution time in many cases.
Your mileage will vary.
|
|
|
|
|
This message is only shown to the SELECT few...
|
|
|
|
|
That's bang out of ORDER
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
What version of SQL was that?
What was the count of unions that caused this?
Thank you.
|
|
|
|
|
Which means "Stop doing this to us in here!"
Just for more gig-gles, sent it over and over and see is the "rare event" message changes.
|
|
|
|
|
struct Record
{
unsigned short Length;
unsigned long ObjectId;
LevelType Level;
unsigned long SendBlock;
struct
{
unsigned long SendBlock : 31;
unsigned long SendBlockMarker : 1;
};
__time32_t SendTime;
struct
{
Type SendType : 16;
unsigned SendVersion : 16;
};
unsigned long SendNumber;
union
{
struct
{
char Message[1];
} Version0;
struct
{
__int64 EventTime;
char Message[1];
} Version1;
};
};
:face-palm:
Software Zen: delete this;
|
|
|
|