Conversation
…n JPEG decoder Signed-off-by: Caijinglong <cjl_spy@163.com>
Signed-off-by: Caijinglong <cjl_spy@163.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue with async JPEG image processing by removing incorrect orientation data retrieval and adds comprehensive test coverage for async image processing functionality.
- Removes a line that incorrectly attempts to read orientation data from the wrong position in JPEG decoder
- Adds comprehensive test suite for async image processing methods covering multiple image formats
- Updates version to 2.4.1 and documents the fix in changelog
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/image_size_getter/lib/src/decoder/impl/jpeg_decoder.dart | Removes incorrect orientation byte reading that was causing async JPEG processing issues |
| packages/image_size_getter/test/image_size_getter_test.dart | Adds comprehensive test coverage for async image processing methods across multiple formats |
| packages/image_size_getter/pubspec.yaml | Bumps version to 2.4.1 |
| packages/image_size_getter/CHANGELOG.md | Documents the JPEG orientation fix |
Comments suppressed due to low confidence (1)
packages/image_size_getter/lib/src/decoder/impl/jpeg_decoder.dart:95
- The removal of this line fixes a bug where orientation data was being read from an incorrect offset (start + 9) in the JPEG structure. This was likely causing incorrect orientation values or potential out-of-bounds reads in async JPEG processing.
return _getSize(widthList, heightList, orientation);
|
|
||
| test('Test getSizeAsync with unsupported format', () async { | ||
| // Create a temporary file with unsupported content | ||
| final tempFile = File('../../example/asset/temp_unsupported.txt'); |
There was a problem hiding this comment.
The test creates temporary files in the asset directory which could cause issues if tests run concurrently or fail unexpectedly. Consider using a system temp directory or test-specific directory to avoid potential conflicts with existing asset files.
| final tempFile = File('../../example/asset/temp_unsupported.txt'); | |
| final tempFile = File('${Directory.systemTemp.path}/temp_unsupported_${DateTime.now().microsecondsSinceEpoch}.txt'); |
|
|
||
| test('Test getSizeResultAsync with unsupported format', () async { | ||
| // Create a temporary file with unsupported content | ||
| final tempFile = File('../../example/asset/temp_unsupported2.txt'); |
There was a problem hiding this comment.
Similar to the previous test, this creates a temporary file in the asset directory. Consider using a system temp directory or test-specific directory to avoid potential conflicts with existing asset files.
| final tempFile = File('../../example/asset/temp_unsupported2.txt'); | |
| final tempFile = File('${Directory.systemTemp.path}/temp_unsupported2.txt'); |
No description provided.