From 785c34f36bc922c11f01ceb9de8ba69569109090 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Thu, 23 Mar 2023 23:34:09 +0800 Subject: [PATCH] bump: 0.0.15 --- CHANGELOG.md | 6 ++++++ linux/include/texture_rgba_renderer/texture_rgba_renderer.h | 2 +- linux/texture_rgba_renderer_plugin.cc | 5 +++++ pubspec.yaml | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 802d0ea..1300cbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.0.15 +* opt: add the parameter check for len,width,height on Linux. + +## 0.0.14 +* fix: remove the `copy_pixels` function pointer initialization in texture rgba class. + ## 0.0.13 * try to fix the memory leak on macOS. diff --git a/linux/include/texture_rgba_renderer/texture_rgba_renderer.h b/linux/include/texture_rgba_renderer/texture_rgba_renderer.h index 765344e..3213ba5 100644 --- a/linux/include/texture_rgba_renderer/texture_rgba_renderer.h +++ b/linux/include/texture_rgba_renderer/texture_rgba_renderer.h @@ -154,7 +154,7 @@ static TextureRgba *texture_rgba_new(FlTextureRegistrar* registrar) static void texture_rgba_class_init(TextureRgbaClass *klass) { - // FL_PIXEL_BUFFER_TEXTURE_GET_CLASS(klass)->copy_pixels = texture_rgba_copy_pixels; + FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels = texture_rgba_copy_pixels; } static void texture_rgba_init(TextureRgba* self) { diff --git a/linux/texture_rgba_renderer_plugin.cc b/linux/texture_rgba_renderer_plugin.cc index 434c90a..c4ceaf0 100644 --- a/linux/texture_rgba_renderer_plugin.cc +++ b/linux/texture_rgba_renderer_plugin.cc @@ -142,6 +142,11 @@ void texture_rgba_renderer_plugin_register_with_registrar(FlPluginRegistrar *reg extern "C" { void FlutterRgbaRendererPluginOnRgba(void *texture_rgba_ptr, const uint8_t *buffer, int len, int width, int height, int stride_align) { + // Check whether the parameter is valid. + if (len != 4 * width * height || width == 0 || height == 0) { + g_warning("The data length, width, height is not valid, ignoring this request."); + return; + } TextureRgba* self = TEXTURE_RGBA(texture_rgba_ptr); g_mutex_lock(&self->mutex); // selfate has registered a texture_id, diff --git a/pubspec.yaml b/pubspec.yaml index 006b309..97e82d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: texture_rgba_renderer description: A texture helper which brings a high level api to handle BGRA data. -version: 0.0.13 +version: 0.0.15 homepage: https://github.com/Kingtous/flutter_texture_rgba_renderer environment: