mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[iso] fix libcio processing of Rock Ridge CE fields
* Boy do you not want to use chars in struct iso_su_ce_s as
  from_733() will sign extend the bytes and you will end up
  with an offset like 0xffffffc4 instead of 0x000000c4...
* Addresses the leftover from 6c44dccc10.
* Also some headers clean up and pick up latest libcdio changes.
			
			
This commit is contained in:
		
							parent
							
								
									6c44dccc10
								
							
						
					
					
						commit
						cb561e7176
					
				
					 3 changed files with 60 additions and 49 deletions
				
			
		|  | @ -98,23 +98,23 @@ PRAGMA_BEGIN_PACKED | ||||||
| 
 | 
 | ||||||
| /*! system-use-sharing protocol */ | /*! system-use-sharing protocol */ | ||||||
| typedef struct iso_su_sp_s{ | typedef struct iso_su_sp_s{ | ||||||
|   unsigned char magic[2]; |   uint8_t       magic[2]; | ||||||
|   uint8_t       skip; |   uint8_t       skip; | ||||||
| } GNUC_PACKED iso_su_sp_t; | } GNUC_PACKED iso_su_sp_t; | ||||||
| 
 | 
 | ||||||
| /*! system-use extension record */ | /*! system-use extension record */ | ||||||
| typedef struct iso_su_er_s { | typedef struct iso_su_er_s { | ||||||
|   iso711_t      len_id;  /**< Identifier length. Value 10?. */ |   iso711_t      len_id;  /**< Identifier length. Value 10?. */ | ||||||
|   unsigned char len_des; |   uint8_t       len_des; | ||||||
|   unsigned char len_src; |   uint8_t       len_src; | ||||||
|   iso711_t      ext_ver; /**< Extension version. Value 1? */ |   iso711_t      ext_ver; /**< Extension version. Value 1? */ | ||||||
|   char          data[EMPTY_ARRAY_SIZE]; |   char          data[EMPTY_ARRAY_SIZE]; | ||||||
| } GNUC_PACKED iso_su_er_t; | } GNUC_PACKED iso_su_er_t; | ||||||
| 
 | 
 | ||||||
| typedef struct iso_su_ce_s { | typedef struct iso_su_ce_s { | ||||||
|   char extent[8]; |   uint8_t       extent[8]; | ||||||
|   char offset[8]; |   uint8_t       offset[8]; | ||||||
|   char size[8]; |   uint8_t       size[8]; | ||||||
| } iso_su_ce_t; | } iso_su_ce_t; | ||||||
| 
 | 
 | ||||||
| /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */ | /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */ | ||||||
|  | @ -165,7 +165,7 @@ typedef struct iso_rock_sl_part_s { | ||||||
| 
 | 
 | ||||||
| /*! Symbolic link. See Rock Ridge Section 4.1.3 */ | /*! Symbolic link. See Rock Ridge Section 4.1.3 */ | ||||||
| typedef struct iso_rock_sl_s { | typedef struct iso_rock_sl_s { | ||||||
|   unsigned char flags; |   uint8_t flags; | ||||||
|   iso_rock_sl_part_t link; |   iso_rock_sl_part_t link; | ||||||
| } GNUC_PACKED iso_rock_sl_t ; | } GNUC_PACKED iso_rock_sl_t ; | ||||||
| 
 | 
 | ||||||
|  | @ -184,7 +184,7 @@ typedef enum { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| typedef struct iso_rock_nm_s { | typedef struct iso_rock_nm_s { | ||||||
|   unsigned char flags; |   uint8_t flags; | ||||||
|   char name[EMPTY_ARRAY_SIZE]; |   char name[EMPTY_ARRAY_SIZE]; | ||||||
| } GNUC_PACKED iso_rock_nm_t ; | } GNUC_PACKED iso_rock_nm_t ; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| /*
 | /*
 | ||||||
|   Copyright (C) 2020 Pete Batard <pete@akeo.ie> |   Copyright (C) 2020, 2023 Pete Batard <pete@akeo.ie> | ||||||
|   Copyright (C) 2005, 2008, 2010-2011, 2014, 2017 Rocky Bernstein |   Copyright (C) 2005, 2008, 2010-2011, 2014, 2017, 2022 Rocky Bernstein | ||||||
|   <rocky@gnu.org> |   <rocky@gnu.org> | ||||||
| 
 | 
 | ||||||
|   Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale |   Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale | ||||||
|  | @ -103,14 +103,16 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow) | ||||||
|    is done correctly */ |    is done correctly */ | ||||||
| 
 | 
 | ||||||
| #define CONTINUE_DECLS \ | #define CONTINUE_DECLS \ | ||||||
|   int cont_extent = 0, cont_offset = 0, cont_size = 0;   \ |   uint32_t cont_extent = 0, cont_offset = 0, cont_size = 0;	\ | ||||||
|   void *buffer = NULL |   uint8_t *buffer = NULL | ||||||
| 
 | 
 | ||||||
| #define CHECK_CE				 \ | #define CHECK_CE(FAIL)				\ | ||||||
|   { cont_extent = from_733(*rr->u.CE.extent);	\ |   { cont_extent = from_733(*rr->u.CE.extent);	\ | ||||||
|     cont_offset = from_733(*rr->u.CE.offset);	\ |     cont_offset = from_733(*rr->u.CE.offset);	\ | ||||||
|  |     if (cont_offset >= ISO_BLOCKSIZE) FAIL;	\ | ||||||
|     cont_size = from_733(*rr->u.CE.size);	\ |     cont_size = from_733(*rr->u.CE.size);	\ | ||||||
|     (void)cont_extent; (void)cont_offset, (void)cont_size; } |     if (cont_size >= ISO_BLOCKSIZE) FAIL;	\ | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
| #define SETUP_ROCK_RIDGE(DE,CHR,LEN)				\ | #define SETUP_ROCK_RIDGE(DE,CHR,LEN)				\ | ||||||
|   {								\ |   {								\ | ||||||
|  | @ -202,7 +204,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, | ||||||
| 
 | 
 | ||||||
|       switch(sig) { |       switch(sig) { | ||||||
|       case SIG('S','P'): |       case SIG('S','P'): | ||||||
| 	CHECK_SP(goto out); | 	CHECK_SP({cdio_warn("Invalid Rock Ridge SP field"); goto out;}); | ||||||
| 	p_stat->rr.u_su_fields |= ISO_ROCK_SUF_SP; | 	p_stat->rr.u_su_fields |= ISO_ROCK_SUF_SP; | ||||||
| 	break; | 	break; | ||||||
|       case SIG('C','E'): |       case SIG('C','E'): | ||||||
|  | @ -213,8 +215,17 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, | ||||||
| 	  if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) | 	  if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) | ||||||
| 	    break; | 	    break; | ||||||
| 	} | 	} | ||||||
| 	CHECK_CE; | 	CHECK_CE({cdio_warn("Invalid Rock Ridge CE field"); goto out;}); | ||||||
| 	p_stat->rr.u_su_fields |= ISO_ROCK_SUF_CE; | 	p_stat->rr.u_su_fields |= ISO_ROCK_SUF_CE; | ||||||
|  | 	/* We may already be processing a continuation block so free it */ | ||||||
|  | 	free(buffer); | ||||||
|  | 	buffer = calloc(1, ISO_BLOCKSIZE); | ||||||
|  | 	if (!buffer) | ||||||
|  | 	  goto out; | ||||||
|  | 	if (iso9660_iso_seek_read(p_image, buffer, cont_extent, 1) != ISO_BLOCKSIZE) | ||||||
|  | 	  goto out; | ||||||
|  | 	chr = &buffer[cont_offset]; | ||||||
|  | 	len = cont_size; | ||||||
| 	break; | 	break; | ||||||
|       case SIG('E','R'): |       case SIG('E','R'): | ||||||
| 	cdio_debug("ISO 9660 Extensions: "); | 	cdio_debug("ISO 9660 Extensions: "); | ||||||
|  | @ -471,7 +482,7 @@ iso9660_get_rock_attr_str(posix_mode_t st_mode) | ||||||
|   result[ 8] = (st_mode & ISO_ROCK_IWOTH) ? 'w' : '-'; |   result[ 8] = (st_mode & ISO_ROCK_IWOTH) ? 'w' : '-'; | ||||||
|   result[ 9] = (st_mode & ISO_ROCK_IXOTH) ? 'x' : '-'; |   result[ 9] = (st_mode & ISO_ROCK_IXOTH) ? 'x' : '-'; | ||||||
| 
 | 
 | ||||||
|   result[11] = '\0'; |   result[10] = '\0'; | ||||||
| 
 | 
 | ||||||
|   return result; |   return result; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.22.1984" | CAPTION "Rufus 3.22.1985" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -392,8 +392,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,22,1984,0 |  FILEVERSION 3,22,1985,0 | ||||||
|  PRODUCTVERSION 3,22,1984,0 |  PRODUCTVERSION 3,22,1985,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -411,13 +411,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.22.1984" |             VALUE "FileVersion", "3.22.1985" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.22.exe" |             VALUE "OriginalFilename", "rufus-3.22.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.22.1984" |             VALUE "ProductVersion", "3.22.1985" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue