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
Resize compression buffer as needed in decompression [DNET944] #298
Comments
Commented by: @cincuranet Do I understand correctly that you overrun the default buffer size when simply selecting from SELECT * FROM RDB$PROCEDURES? |
Modified by: @cincuranetstatus: Open [ 1 ] => In Progress [ 3 ] |
Commented by: tonim (tonim) Not exactly, I also altered some connection string parameters like packet size set to 32000. Anyway you can't expect variable decompressed data will allways fit in a fixed buffer, so in my opinion the current implementation of HandleDecompresion is wrong. I think there is not a maximum compression ratio (only typical compression ratios for some types of contents). You can reproduce the bug easily in any database by setting a default decompressed buffer size of 8000 for example (and of course Compression flag in connection string) If you need a sample project including a database reproducing the bug with the 1 megabyte buffer size I will provide you. Thanks. |
Commented by: @cincuranet > You can reproduce the bug easily in any database by setting a default decompressed buffer size of 8000 for example (and of course Compression flag in connection string) Sure. One can make the buffer 1 byte and it will fail. > If you need a sample project including a database reproducing the bug with the 1 megabyte buffer size I will provide you. Yeah, that would be interesting to see. |
Commented by: tonim (tonim) Here is a link with a very simple proyect doing a connection and a reading data with DataReader, reproducing the bug "decompression buffer too small". |
Commented by: @cincuranet Thanks. I changed the code to resize the buffer as needed (just using Array.Resize for easier/better code). Now I think I have to handle the compression as well, because with smaller buffer it's easier to not have enough to compress complete `buffer`. |
Modified by: @cincuranetVersion: 7.5.0.0 [ 10915 ] Fix Version: vNext [ 10920 ] summary: Compression buffer too small error thrown => Resize compression buffer as needed in decompression Version: vNext [ 10920 ] => |
Submitted by: tonim (tonim)
Jira_subtask_outward DNET948
Any environment, when selecting Compression=true in Connection string, more common selecting packetsize=32000
A big constant decompression buffer size is defined in FirebirdNetwordStream.
const int CompressionBufferSize = 1 * 1024 * 1024;
Any decompression bigger than this size throws an exception in HandleDecompression function.
I provide a tested fix, the buffer will grow dynamically, depending on the uncompressed size.
Commits: c1d674c
The text was updated successfully, but these errors were encountered: