[Cin] unaligned load in bctheme

Andrew Randrianasulu randrianasulu at gmail.com
Fri Dec 2 01:26:08 CET 2022


пт, 2 дек. 2022 г., 01:16 Phyllis Smith <phylsmith2017 at gmail.com>:

> ANDREW, Perhaps I duplicated this incorrectly, but when I add after the
> line    CFLAGS += $(static_incs)  the line
> CFLAGS += -Wall -fsanitize=alignment   in guicast/Makefile to demonstrate
> the problem, I just get compiler errors. I also set the environment
> variable LDFLAGS and when I do    echo $LDFLAGS    it shows
> -fsanitize=alignment   .
>


I set LDFLAGS for this case before make command like (from bash history)


LDFLAGS=-fsanitize=alignment make -j 8

and this make was called in cinelerra directory (and before this in guicast
directory), not from top level where autogen.sh and configure lives.

but you can add LDFLAGS directly to cinelerra/Makefile too, I think.


Did I make a mistake?  Did I miss a step?  The only steps I read in your
> email was:
>    (1) modify guicast/Makefile to add another CFLAGS line
>

> I also added it to cinelerra/Makefile lately just to see if main program
had additional problems, thankfully (?) I saw no more errors during playback



>    (2) set environment variable for LDFLAGS   (before LDFLAGS had no value)
>
> See below for the end of my log file.
>
> /usr/bin/ld:
>> /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o):
>> in function `BC_ListBoxItem::compare_item_text(void const*, void const*)':
>> /tmp/cinelerra-5.1/guicast/bclistboxitem.C:162: undefined reference to
>> `__ubsan_handle_type_mismatch_v1'
>> /usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:163: undefined
>> reference to `__ubsan_handle_type_mismatch_v1'
>> /usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:163: undefined
>> reference to `__ubsan_handle_type_mismatch_v1'
>> /usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:162: undefined
>> reference to `__ubsan_handle_type_mismatch_v1'
>> /usr/bin/ld:
>> /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o):
>> in function `ArrayList<BC_ListBoxItem*>::del(BC_ListBoxItem*&)':
>>
> /tmp/cinelerra-5.1/guicast/arraylist.h:14: undefined reference to
>> `__ubsan_handle_type_mismatch_v1'
>> /usr/bin/ld:
>> /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o):/tmp/cinelerra-5.1/guicast/arraylist.h:14:
>> more undefined references to `__ubsan_handle_type_mismatch_v1' follow
>> collect2: error: ld returned 1 exit status
>> make[2]: *** [Makefile:607: x86_64/lv2ui] Error 1
>>
> make[2]: *** Waiting for unfinished jobs....
>> make[2]: Leaving directory '/tmp/cinelerra-5.1/cinelerra'
>> make[1]: *** [Makefile:582: all-recursive] Error 1
>> make[1]: Leaving directory '/tmp/cinelerra-5.1'
>>
> make: *** [Makefile:529: all] Error 2
>>
>
> On Wed, Nov 23, 2022 at 11:37 PM Andrew Randrianasulu <
> randrianasulu at gmail.com> wrote:
>
>>
>> ---------- Forwarded message ---------
>> От: Андрей Рандрианасулу <randrik at mail.ru>
>> Date: чт, 24 нояб. 2022 г., 09:33
>> Subject: unaligned load in bctheme
>> To: randrianasulu <randrianasulu at gmail.com>
>>
>>
>> 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)
>>
>> --
>> Андрей  Рандрианасулу
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20221202/36b7e68a/attachment-0001.htm>


More information about the Cin mailing list