Handling of files of unknown size is currently limited. They can't be
used e.g. for initrd or modules. Moreover gzip handling of not easily seekable files is buggy. Disable unknown file size for now. May be inefficient but works. * grub-core/io/gzio.c (test_header): Always retrieve the file size. * grub-core/io/xzio.c (grub_xzio_open): Likewise.
This commit is contained in:
		
							parent
							
								
									5c408d0f50
								
							
						
					
					
						commit
						0b2db94300
					
				
					 3 changed files with 24 additions and 14 deletions
				
			
		|  | @ -212,19 +212,18 @@ test_header (grub_file_t file) | |||
| 
 | ||||
|   gzio->data_offset = grub_file_tell (gzio->file); | ||||
| 
 | ||||
|   grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4); | ||||
| 
 | ||||
|   if (grub_file_seekable (gzio->file)) | ||||
|     { | ||||
|       if (grub_file_read (gzio->file, &orig_len, 4) != 4) | ||||
| 	{ | ||||
| 	  grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format"); | ||||
| 	  return 0; | ||||
| 	} | ||||
|     } | ||||
|   /* FIXME: this does not handle files whose original size is over 4GB.
 | ||||
|      But how can we know the real original size?  */ | ||||
|   file->size = grub_le_to_cpu32 (orig_len); | ||||
|   /* FIXME: don't do this on not easily seekable files.  */ | ||||
|   { | ||||
|     grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4); | ||||
|     if (grub_file_read (gzio->file, &orig_len, 4) != 4) | ||||
|       { | ||||
| 	grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format"); | ||||
| 	return 0; | ||||
|       } | ||||
|     /* FIXME: this does not handle files whose original size is over 4GB.
 | ||||
|        But how can we know the real original size?  */ | ||||
|     file->size = grub_le_to_cpu32 (orig_len); | ||||
|   } | ||||
| 
 | ||||
|   initialize_tables (file); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue