Am Sat, 22 Jan 2022 19:06:59 +0100
schrieb Kornel Benko <kor...@lyx.org>:

> Am Sat, 22 Jan 2022 18:35:12 +0100
> schrieb Kornel Benko <kor...@lyx.org>:
> 
> > Am Sat, 22 Jan 2022 10:04:44 -0500
> > schrieb Scott Kostyshak <skost...@lyx.org>:
> >   
> > > With Clang and fsanitize, I get the following error when I open a buffer:
> > > 
> > >   runtime error: load of value 4294967293, which is not a valid value for 
> > > type
> > > 'const lyx::Update::flags'
> > > 
> > > Attached is the backtrace (which is printed to terminal if I set 'export
> > > UBSAN_OPTIONS=print_stacktrace=1').
> > > 
> > > Scott    
> > 
> > I see the same here. (No crash, but the messages on terminal)
> > 
> >     Kornel  
> 
> If I understand it correctly, the routine
>       inline flags operator&(flags const f, flags const g)
> gets the value f as:
>       (update_flags & ~Update::Force)
> Since 32-bit-value 4294967293 is the same as '~Update::Force', which is too 
> big for
> 32-bit integer, we possibly have the same 'problem' as with colors.
> 
> BTW Update::Force is defined as '2' and the hex value of 4294967293 is 
> FFFFFFFD.
> 
>       Kornel

Here 2 possible patches which do not show the behaviour.
(I prefer the number 2)

        Kornel
diff --git a/src/update_flags.h b/src/update_flags.h
index 0efa541122..f1e18bc3a4 100644
--- a/src/update_flags.h
+++ b/src/update_flags.h
@@ -29,11 +29,13 @@ namespace Update {
 		SinglePar = 8,
 		/// Only the inset decorations need to be redrawn, no text metrics
 		/// update is needed.
 		Decoration = 16,
 		/// Force metrics and redraw for all buffers.
-		ForceAll = 32
+		ForceAll = 32,
+		/// Satisfy sanitize
+		ExpandType = 0xffffffff
 	};
 
 inline flags operator|(flags const f, flags const g)
 {
 	return static_cast<flags>(int(f) | int(g));
diff --git a/src/update_flags.h b/src/update_flags.h
index 0efa541122..517bfb62e4 100644
--- a/src/update_flags.h
+++ b/src/update_flags.h
@@ -44,11 +44,11 @@ inline flags operator&(flags const f, flags const g)
 	return static_cast<flags>(int(f) & int(g));
 }
 
 inline flags operator~(flags const f)
 {
-	return static_cast<flags>(~int(f));
+	return static_cast<flags>(~int(f) & 0x3f);
 }
 
 } // namespace Update
 
 } // namespace lyx

Attachment: pgpWprjCDadP7.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to