вс, 4 дек. 2022 г., 03:39 Phyllis Smith <[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.
On 4 different systems I was only able to include in guicast/Makefile, the CFLAGS += $(-fsanitize=alignment) and set the LDFLAGS environment variable to -fsanitize=alignment in order to compile. But when I ran bin/cin I never got any errors of the type "bctheme.C:458:15: runtime error: load of misaligned address". This was Fedora 32, Ubuntu 16, Debian 32-bit 9.1, and Debian 11.0. I only loaded a file, played a little of it, and added a plugin as a test (maybe there was something in particular I should have tried?)
no, it was right on startup on Slackware 15.0 (mostly) 32-bit over 64-bit kernel.... I'll try on ppc32 machine hopefully soon (ppc/sparc/alpha said to be much more sensitive to such errors)
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 I added the above patch, and all 4 systems compiled and ran the same
limited set of commands to load and play a video file. So it seems OK to check into GIT. Just to verify, only the bctheme.C patch should be checked in - right?