mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[iso] improve Rock Ridge CE handling
This commit is contained in:
		
							parent
							
								
									365449fcce
								
							
						
					
					
						commit
						e524e81e99
					
				
					 6 changed files with 44 additions and 27 deletions
				
			
		|  | @ -41,6 +41,7 @@ | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\iso9660.h" /> |     <ClInclude Include="..\src\libcdio\cdio\iso9660.h" /> | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\logging.h" /> |     <ClInclude Include="..\src\libcdio\cdio\logging.h" /> | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\portable.h" /> |     <ClInclude Include="..\src\libcdio\cdio\portable.h" /> | ||||||
|  |     <ClInclude Include="..\src\libcdio\cdio\rock.h" /> | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\utf8.h" /> |     <ClInclude Include="..\src\libcdio\cdio\utf8.h" /> | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\util.h" /> |     <ClInclude Include="..\src\libcdio\cdio\util.h" /> | ||||||
|     <ClInclude Include="..\src\libcdio\config.h" /> |     <ClInclude Include="..\src\libcdio\config.h" /> | ||||||
|  |  | ||||||
|  | @ -53,6 +53,9 @@ | ||||||
|     <ClInclude Include="..\src\libcdio\cdio\portable.h"> |     <ClInclude Include="..\src\libcdio\cdio\portable.h"> | ||||||
|       <Filter>Header Files</Filter> |       <Filter>Header Files</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  |     <ClInclude Include="..\src\libcdio\cdio\rock.h"> | ||||||
|  |       <Filter>Header Files</Filter> | ||||||
|  |     </ClInclude> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ClCompile Include="..\src\libcdio\iso9660\iso9660_fs.c"> |     <ClCompile Include="..\src\libcdio\iso9660\iso9660_fs.c"> | ||||||
|  |  | ||||||
|  | @ -112,10 +112,10 @@ typedef struct iso_su_er_s { | ||||||
| } GNUC_PACKED iso_su_er_t; | } GNUC_PACKED iso_su_er_t; | ||||||
| 
 | 
 | ||||||
| typedef struct iso_su_ce_s { | typedef struct iso_su_ce_s { | ||||||
|   uint8_t       extent[8]; |   iso733_t      extent; | ||||||
|   uint8_t       offset[8]; |   iso733_t      offset; | ||||||
|   uint8_t       size[8]; |   iso733_t      size; | ||||||
| } iso_su_ce_t; | } GNUC_PACKED 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 */ | ||||||
| typedef struct iso_rock_px_s { | typedef struct iso_rock_px_s { | ||||||
|  |  | ||||||
|  | @ -729,7 +729,7 @@ iso9660_dir_add_entry_su(void *dir, | ||||||
|   unsigned int offset = 0; |   unsigned int offset = 0; | ||||||
|   uint32_t dsize = from_733(idr->size); |   uint32_t dsize = from_733(idr->size); | ||||||
|   int length, su_offset; |   int length, su_offset; | ||||||
|   struct tm temp_tm; |   struct tm temp_tm = { 0 }; | ||||||
|   cdio_assert (sizeof(iso9660_dir_t) == 33); |   cdio_assert (sizeof(iso9660_dir_t) == 33); | ||||||
| 
 | 
 | ||||||
|   if (!dsize && !idr->length) |   if (!dsize && !idr->length) | ||||||
|  |  | ||||||
|  | @ -20,7 +20,8 @@ | ||||||
| */ | */ | ||||||
| /* Rock Ridge Extensions to iso9660 */ | /* Rock Ridge Extensions to iso9660 */ | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| #ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | ||||||
| # include "config.h" | # include "config.h" | ||||||
| #endif | #endif | ||||||
|  | @ -104,17 +105,17 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow) | ||||||
| 
 | 
 | ||||||
| #define CONTINUE_DECLS \ | #define CONTINUE_DECLS \ | ||||||
|   uint32_t cont_extent = 0, cont_offset = 0, cont_size = 0;	\ |   uint32_t cont_extent = 0, cont_offset = 0, cont_size = 0;	\ | ||||||
|   uint8_t *buffer = NULL |   uint8_t *buffer = NULL, ce_count = 0 | ||||||
| 
 | 
 | ||||||
| #define CHECK_CE(FAIL)				\ | #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;	\ |     if (cont_offset >= ISO_BLOCKSIZE) FAIL;	\ | ||||||
|     cont_size = from_733(*rr->u.CE.size);	\ |     cont_size = from_733(rr->u.CE.size);	\ | ||||||
|     if (cont_size >= ISO_BLOCKSIZE) FAIL;	\ |     if (cont_size >= ISO_BLOCKSIZE) FAIL;	\ | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| #define SETUP_ROCK_RIDGE(DE,CHR,LEN)				\ | #define SETUP_ROCK_RIDGE(DE, CHR, LEN)				\ | ||||||
|   {								\ |   {								\ | ||||||
|     LEN= sizeof(iso9660_dir_t) + DE->filename.len;		\ |     LEN= sizeof(iso9660_dir_t) + DE->filename.len;		\ | ||||||
|     if (LEN & 1) LEN++;						\ |     if (LEN & 1) LEN++;						\ | ||||||
|  | @ -181,7 +182,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, | ||||||
|   *psz_name = 0; |   *psz_name = 0; | ||||||
| 
 | 
 | ||||||
|   SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); |   SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); | ||||||
|   /*repeat:*/ | repeat: | ||||||
|   { |   { | ||||||
|     iso_extension_record_t * rr; |     iso_extension_record_t * rr; | ||||||
|     int sig; |     int sig; | ||||||
|  | @ -217,15 +218,10 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, | ||||||
| 	} | 	} | ||||||
| 	CHECK_CE({cdio_warn("Invalid Rock Ridge CE field"); goto out;}); | 	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 */ | 	/* Though no mastering utility in its right mind would produce anything
 | ||||||
| 	free(buffer); | 	   like this, the specs make it theoretically possible to have more RR | ||||||
| 	buffer = calloc(1, ISO_BLOCKSIZE); | 	   extensions after a CE, so we delay the CE block processing for later. | ||||||
| 	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: "); | ||||||
|  | @ -379,9 +375,26 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   /* Process delayed CE blocks */ | ||||||
|  |   if (cont_size != 0) { | ||||||
|       free(buffer); |       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; | ||||||
|  |       cont_size = 0; | ||||||
|  |       /* Someone abusing the specs may also be creating looping CEs */ | ||||||
|  |       if (ce_count++ < 64) | ||||||
|  | 	  goto repeat; | ||||||
|  |       else | ||||||
|  | 	  cdio_warn("More than 64 consecutive Rock Ridge CEs detected"); | ||||||
|  |   } | ||||||
|   if (p_stat->rr.u_su_fields & ISO_ROCK_SUF_FORMAL) |   if (p_stat->rr.u_su_fields & ISO_ROCK_SUF_FORMAL) | ||||||
|     p_stat->rr.b3_rock = yep; |     p_stat->rr.b3_rock = yep; | ||||||
|  |   free(buffer); | ||||||
|   return i_namelen; /* If 0, this file did not have a NM field */ |   return i_namelen; /* If 0, this file did not have a NM field */ | ||||||
| out: | out: | ||||||
|   free(buffer); |   free(buffer); | ||||||
|  |  | ||||||
							
								
								
									
										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.2005" | CAPTION "Rufus 3.22.2006" | ||||||
| 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,2005,0 |  FILEVERSION 3,22,2006,0 | ||||||
|  PRODUCTVERSION 3,22,2005,0 |  PRODUCTVERSION 3,22,2006,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.2005" |             VALUE "FileVersion", "3.22.2006" | ||||||
|             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.2005" |             VALUE "ProductVersion", "3.22.2006" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue