---------- Forwarded message --------- От: Андрей Рандрианасулу <[email protected]> Date: чт, 24 нояб. 2022 г., 09:33 Subject: unaligned load in bctheme To: randrianasulu <[email protected]> so i tried to instrument cingg to see if she does any unaligned access I added diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile index 04d5a2e5..b724c668 100644 --- a/cinelerra-5.1/guicast/Makefile +++ b/cinelerra-5.1/guicast/Makefile @@ -116,6 +116,7 @@ UTILS = $(OBJDIR)/bootstrap $(OBJDIR)/pngtoh $(OBJDIR)/pngto raw BCXFER = xfer/$(OBJDIR)/xfer.stamp CFLAGS += $(static_incs) +CFLAGS += -Wall -fsanitize=alignment $(shell echo $(CFLAGS) > $(OBJDIR)/c_flags) $(shell echo $(OBJS) > $(OBJDIR)/objs) and same -fsanitize=alignment to LDFLAGS env. variable before make. I got this: bash-5.1$ /dev/shm/cinelerra/cinelerra-5.1/bin/cin Cinelerra Infinity - built: Nov 24 2022 08:52:45 git://git.cinelerra-gg.org/goodguy/cinelerra.git (c) 2006-2019 Heroine Virtual Ltd. by Adam Williams 2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy Cinelerra is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. There is absolutely no warranty for Cinelerra. build plugin index for: /dev/shm/cinelerra/cinelerra-5.1/bin/plugins PluginFFilter::new_ffilter(overlay_opencl) err: Input/output error PluginFFilter::new_ffilter(xfade_opencl) err: Input/output error [openclsrc_814 @ 0xb78f400] OpenCL source requires output dimensions to be specified. PluginFFilter::new_ffilter(openclsrc) err: Invalid argument bctheme.C:458:15: runtime error: load of misaligned address 0x098a364d for type 'int', which requires 4 byte alignment 0x098a364d: note: pointer points here 45 47 27 00 48 21 00 00 31 30 38 30 74 6f 34 38 30 2e 70 6e 67 00 00 00 00 00 31 30 38 30 74 6f ^ Total excess of backups: -50 Session time: 0:00:07 Cpu time: user: 0:00:03.699 sys: 0:00:00.480 so patch below fixes this error. Can you please test it on various arches and distros? diff --git a/cinelerra-5.1/guicast/bctheme.C b/cinelerra-5.1/guicast/bctheme.C index 1ec64c7f..9addf9f7 100644 --- a/cinelerra-5.1/guicast/bctheme.C +++ b/cinelerra-5.1/guicast/bctheme.C @@ -455,7 +455,10 @@ void BC_Theme::overlay(VFrame *dst, VFrame *src, int in_x1, int in_x2, int shift void BC_Theme::set_data(unsigned char *ptr) { - int hdr_sz = *(int*)ptr - sizeof(int); + //int hdr_sz = *(int*)ptr - sizeof(int); + int hdr_sz = 0; + memcpy(&hdr_sz, ptr, sizeof(int)); + hdr_sz -= sizeof(int); unsigned char *cp = ptr + sizeof(int); unsigned char *dp = cp + hdr_sz; int start_item = images.size(); lines 7-28/28 (END) -- Андрей Рандрианасулу