diff options
| author | Michael Albinus | 2014-11-13 16:29:20 +0100 |
|---|---|---|
| committer | Michael Albinus | 2014-11-13 16:29:20 +0100 |
| commit | d856e6b0d87fed67001e83fcfccba9c932af3487 (patch) | |
| tree | a4bf9bbfeedc89d0d7ed5240910cc890445ce4ca /src | |
| parent | a85cf0d9fe03713cfae31415208cbd49d3227ae1 (diff) | |
| parent | 38fa4bcbd238a0628ca51c5cd656211a0ef62eef (diff) | |
| download | emacs-d856e6b0d87fed67001e83fcfccba9c932af3487.tar.gz emacs-d856e6b0d87fed67001e83fcfccba9c932af3487.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Conflicts:
lisp/ChangeLog
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/image.c | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d44de652dde..2be24fa851b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-11-13 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Avoid undefined behavior in color table hashing. | ||
| 4 | * image.c (CT_HASH_RGB) [COLOR_TABLE_SUPPORT]: Remove, replacing with ... | ||
| 5 | (ct_hash_rgb) [COLOR_TABLE_SUPPORT]: New function. All uses changed. | ||
| 6 | This function avoids undefined behavior with signed shift overflow. | ||
| 7 | |||
| 1 | 2014-11-10 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-11-10 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * fileio.c (Finsert_file_contents): Invalidate buffer caches also | 10 | * fileio.c (Finsert_file_contents): Invalidate buffer caches also |
diff --git a/src/image.c b/src/image.c index 4b73a5fe80c..1a2c0e29dde 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4294,7 +4294,11 @@ struct ct_color | |||
| 4294 | 4294 | ||
| 4295 | /* Value is a hash of the RGB color given by R, G, and B. */ | 4295 | /* Value is a hash of the RGB color given by R, G, and B. */ |
| 4296 | 4296 | ||
| 4297 | #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B)) | 4297 | static unsigned |
| 4298 | ct_hash_rgb (unsigned r, unsigned g, unsigned b) | ||
| 4299 | { | ||
| 4300 | return (r << 16) ^ (g << 8) ^ b; | ||
| 4301 | } | ||
| 4298 | 4302 | ||
| 4299 | /* The color hash table. */ | 4303 | /* The color hash table. */ |
| 4300 | 4304 | ||
| @@ -4349,7 +4353,7 @@ free_color_table (void) | |||
| 4349 | static unsigned long | 4353 | static unsigned long |
| 4350 | lookup_rgb_color (struct frame *f, int r, int g, int b) | 4354 | lookup_rgb_color (struct frame *f, int r, int g, int b) |
| 4351 | { | 4355 | { |
| 4352 | unsigned hash = CT_HASH_RGB (r, g, b); | 4356 | unsigned hash = ct_hash_rgb (r, g, b); |
| 4353 | int i = hash % CT_SIZE; | 4357 | int i = hash % CT_SIZE; |
| 4354 | struct ct_color *p; | 4358 | struct ct_color *p; |
| 4355 | Display_Info *dpyinfo; | 4359 | Display_Info *dpyinfo; |