From eeb2b65a7d5d79af3588ca5cf7e00c4ffd645ea7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 13 Mar 2012 16:05:12 +0000 Subject: [PATCH] Mark some variables as volatile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using setjmp/longjmp the state of local variables can be undefined in certain scenarios: [quote man(longjmp)] The values of automatic variables are unspecified after a call to longjmp() if they meet all the following criteria: · they are local to the function that made the correspond‐ ing setjmp(3) call; · their values are changed between the calls to setjmp(3) and longjmp(); and · they are not declared as volatile. [/quote] * server/red_worker.c: Mark some vars as volatile Signed-off-by: Daniel P. Berrange --- server/red_worker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/red_worker.c b/server/red_worker.c index 87118b66..32d390d7 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -5926,9 +5926,9 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest, LzData *lz_data = &worker->lz_data; JpegEncoderContext *jpeg = worker->jpeg; LzContext *lz = worker->lz; - JpegEncoderImageType jpeg_in_type; + volatile JpegEncoderImageType jpeg_in_type; int jpeg_size = 0; - int has_alpha = FALSE; + volatile int has_alpha = FALSE; int alpha_lz_size = 0; int comp_head_filled; int comp_head_left; @@ -6066,7 +6066,7 @@ static inline int red_quic_compress_image(DisplayChannelClient *dcc, SpiceImage RedWorker *worker = display_channel->common.worker; QuicData *quic_data = &worker->quic_data; QuicContext *quic = worker->quic; - QuicImageType type; + volatile QuicImageType type; int size, stride; #ifdef COMPRESS_STAT