Repository: godot
Issue: Usage of invalid memory when using Image.decompress function
Labels: bug,topic:core

**Godot version:**
3.2.4.rc.custom_build. 8385a0d8a


**OS**
Ubuntu 20.04 - Ubuntu 3.36 X11

**Issue description:**
Executing
```
var q_Image : Image = Image.new()

func _process(_delta : float) -> void:
	q_Image = Image.new()
	q_Image.create(10, 3, 36, 25)
	q_Image.decompress()
```


address sanitizer shows this info
```
==196447==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000501404 at pc 0x0000021f4709 bp 0x7ffccf839990 sp 0x7ffccf839980
READ of size 4 at 0x604000501404 thread T0
    #0 0x21f4708 in unpack_5554 modules/pvr/texture_loader_pvr.cpp:228
    #1 0x21fc4f8 in decompress_pvrtc modules/pvr/texture_loader_pvr.cpp:541
    #2 0x21fe483 in _pvrtc_decompress modules/pvr/texture_loader_pvr.cpp:608
    #3 0x113ed06c in Image::decompress() core/image.cpp:1957
    #4 0x20f2890 in MethodBind0R<Error>::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:237
    #5 0x1153558d in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:919
    #6 0x117baa25 in Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) core/variant_call.cpp:1148
    #7 0x1d9958d in GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) modules/gdscript/gdscript_function.cpp:1086
    #8 0x1bca1a0 in GDScriptInstance::call_multilevel(StringName const&, Variant const**, int) modules/gdscript/gdscript.cpp:1224
    #9 0xc032ccd in Node::_notification(int) scene/main/node.cpp:60
    #10 0x1a787ad in Node::_notificationv(int, bool) scene/main/node.h:46
    #11 0x1a7ac22 in CanvasItem::_notificationv(int, bool) scene/2d/canvas_item.h:166
    #12 0xdb23a38 in Node2D::_notificationv(int, bool) scene/2d/node_2d.h:38
    #13 0x11535a27 in Object::notification(int, bool) core/object.cpp:929
    #14 0xc161d39 in SceneTree::_notify_group_pause(StringName const&, int) scene/main/scene_tree.cpp:992
    #15 0xc1522c7 in SceneTree::idle(float) scene/main/scene_tree.cpp:529
    #16 0x18dcd08 in Main::iteration() main/main.cpp:2115
    #17 0x17c08fc in OS_X11::run() platform/x11/os_x11.cpp:3628
    #18 0x172cefb in main platform/x11/godot_x11.cpp:56
    #19 0x7f559fdf00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #20 0x172cb1d in _start (/usr/bin/godots+0x172cb1d)

0x604000501404 is located 4 bytes to the right of 48-byte region [0x6040005013d0,0x604000501400)
allocated by thread T0 here:
    #0 0x7f55a0f69517 in malloc (/lib/x86_64-linux-gnu/libasan.so.6+0xb0517)
    #1 0x11a774db in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
    #2 0x19b741d in PoolVector<unsigned char>::resize(int) core/pool_vector.h:583
    #3 0x113e5408 in Image::create(int, int, bool, Image::Format) core/image.cpp:1593
    #4 0x11485abc in Image::_create_empty(int, int, bool, Image::Format) core/image.h:162
    #5 0x114ca741 in MethodBind4<int, int, bool, Image::Format>::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:3115
    #6 0x1153558d in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:919
    #7 0x117baa25 in Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) core/variant_call.cpp:1148
    #8 0x1d9958d in GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) modules/gdscript/gdscript_function.cpp:1086
    #9 0x1bca1a0 in GDScriptInstance::call_multilevel(StringName const&, Variant const**, int) modules/gdscript/gdscript.cpp:1224
    #10 0xc032ccd in Node::_notification(int) scene/main/node.cpp:60
    #11 0x1a787ad in Node::_notificationv(int, bool) scene/main/node.h:46
    #12 0x1a7ac22 in CanvasItem::_notificationv(int, bool) scene/2d/canvas_item.h:166
    #13 0xdb23a38 in Node2D::_notificationv(int, bool) scene/2d/node_2d.h:38
    #14 0x11535a27 in Object::notification(int, bool) core/object.cpp:929
    #15 0xc161d39 in SceneTree::_notify_group_pause(StringName const&, int) scene/main/scene_tree.cpp:992
    #16 0xc1522c7 in SceneTree::idle(float) scene/main/scene_tree.cpp:529
    #17 0x18dcd08 in Main::iteration() main/main.cpp:2115
    #18 0x17c08fc in OS_X11::run() platform/x11/os_x11.cpp:3628
    #19 0x172cefb in main platform/x11/godot_x11.cpp:56
    #20 0x7f559fdf00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow modules/pvr/texture_loader_pvr.cpp:228 in unpack_5554

```