@@ -820,6 +820,24 @@ START_TEST(test_gpt_parse_partition_first_gt_last)
820820}
821821END_TEST
822822
823+ START_TEST (test_gpt_parse_partition_first_eq_last )
824+ {
825+ uint8_t entry [128 ];
826+ struct gpt_part_entry * pe = (struct gpt_part_entry * )entry ;
827+ struct gpt_part_info info ;
828+
829+ memset (entry , 0 , sizeof (entry ));
830+ pe -> type [0 ] = 0x0001020304050607ULL ;
831+ pe -> type [1 ] = 0x08090A0B0C0D0E0FULL ;
832+ pe -> first = 5 ;
833+ pe -> last = 5 ; /* first == last is a valid single-sector partition */
834+
835+ ck_assert_int_eq (gpt_parse_partition (entry , 128 , & info ), 0 );
836+ ck_assert_uint_eq (info .start , 5 * GPT_SECTOR_SIZE );
837+ ck_assert_uint_eq (info .end , (6 * GPT_SECTOR_SIZE ) - 1 );
838+ }
839+ END_TEST
840+
823841START_TEST (test_gpt_part_name_eq_label_too_long )
824842{
825843 uint16_t name [GPT_PART_NAME_SIZE ];
@@ -955,6 +973,7 @@ Suite *wolfboot_suite(void)
955973 tcase_add_test (tc_cov , test_disk_open_gpt_entry_read_failure );
956974 tcase_add_test (tc_cov , test_gpt_check_mbr_bad_bootsig );
957975 tcase_add_test (tc_cov , test_gpt_parse_partition_first_gt_last );
976+ tcase_add_test (tc_cov , test_gpt_parse_partition_first_eq_last );
958977 tcase_add_test (tc_cov , test_gpt_part_name_eq_label_too_long );
959978 tcase_add_test (tc_cov , test_gpt_part_name_eq_not_null_terminated );
960979 suite_add_tcase (s , tc_cov );
0 commit comments