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