libcdata_array_initialize:
   40|   323k|{
   41|   323k|	libcdata_internal_array_t *internal_array = NULL;
   42|   323k|	static char *function                     = "libcdata_array_initialize";
   43|   323k|	size_t entries_size                       = 0;
   44|   323k|	int number_of_allocated_entries           = 0;
   45|       |
   46|   323k|	if( array == NULL )
  ------------------
  |  Branch (46:6): [True: 0, False: 323k]
  ------------------
   47|      0|	{
   48|      0|		libcerror_error_set(
   49|      0|		 error,
   50|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
   51|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
   52|      0|		 "%s: invalid array.",
   53|      0|		 function );
   54|       |
   55|      0|		return( -1 );
   56|      0|	}
   57|   323k|	if( *array != NULL )
  ------------------
  |  Branch (57:6): [True: 0, False: 323k]
  ------------------
   58|      0|	{
   59|      0|		libcerror_error_set(
   60|      0|		 error,
   61|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
   62|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
   63|      0|		 "%s: invalid array value already set.",
   64|      0|		 function );
   65|       |
   66|      0|		return( -1 );
   67|      0|	}
   68|   323k|	if( number_of_entries < 0 )
  ------------------
  |  Branch (68:6): [True: 0, False: 323k]
  ------------------
   69|      0|	{
   70|      0|		libcerror_error_set(
   71|      0|		 error,
   72|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
   73|      0|		 LIBCERROR_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO,
   74|      0|		 "%s: invalid number of entries value less than zero.",
   75|      0|		 function );
   76|       |
   77|      0|		return( -1 );
   78|      0|	}
   79|   323k|	internal_array = memory_allocate_structure(
  ------------------
  |  |   64|   323k|	(type *) memory_allocate( sizeof( type ) )
  |  |  ------------------
  |  |  |  |   60|   323k|	malloc( size )
  |  |  ------------------
  ------------------
   80|   323k|	                  libcdata_internal_array_t );
   81|       |
   82|   323k|	if( internal_array == NULL )
  ------------------
  |  Branch (82:6): [True: 0, False: 323k]
  ------------------
   83|      0|	{
   84|      0|		libcerror_error_set(
   85|      0|		 error,
   86|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   87|      0|		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
   88|      0|		 "%s: unable to create array.",
   89|      0|		 function );
   90|       |
   91|      0|		goto on_error;
   92|      0|	}
   93|   323k|	if( memory_set(
  ------------------
  |  |  121|   323k|	memset( (void *) buffer, (int) value, count )
  ------------------
  |  Branch (93:6): [True: 0, False: 323k]
  ------------------
   94|   323k|	     internal_array,
   95|   323k|	     0,
   96|   323k|	     sizeof( libcdata_internal_array_t ) ) == NULL )
   97|      0|	{
   98|      0|		libcerror_error_set(
   99|      0|		 error,
  100|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
  101|      0|		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
  102|      0|		 "%s: unable to clear array.",
  103|      0|		 function );
  104|       |
  105|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  106|      0|		 internal_array );
  107|       |
  108|      0|		return( -1 );
  109|      0|	}
  110|       |	/* Pre-allocate in blocks of 16 entries
  111|       |	 */
  112|   323k|	if( number_of_entries >= (int) ( INT_MAX - 16 ) )
  ------------------
  |  Branch (112:6): [True: 0, False: 323k]
  ------------------
  113|      0|	{
  114|      0|		number_of_allocated_entries = INT_MAX;
  115|      0|	}
  116|   323k|	else
  117|   323k|	{
  118|   323k|		number_of_allocated_entries = ( number_of_entries & ~( 15 ) ) + 16;
  119|   323k|	}
  120|   323k|#if SIZEOF_INT <= SIZEOF_SIZE_T
  121|   323k|	if( (size_t) number_of_allocated_entries > (size_t) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
  ------------------
  |  Branch (121:6): [True: 0, False: 323k]
  ------------------
  122|       |#else
  123|       |	if( number_of_allocated_entries > (int) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
  124|       |#endif
  125|      0|	{
  126|      0|		libcerror_error_set(
  127|      0|		 error,
  128|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  129|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  130|      0|		 "%s: invalid number of allocated entries value exceeds maximum.",
  131|      0|		 function );
  132|       |
  133|      0|		goto on_error;
  134|      0|	}
  135|   323k|	entries_size = sizeof( intptr_t * ) * number_of_allocated_entries;
  136|       |
  137|   323k|	if( entries_size > (size_t) LIBCDATA_ARRAY_ENTRIES_MEMORY_LIMIT )
  ------------------
  |  |   78|   323k|#define LIBCDATA_ARRAY_ENTRIES_MEMORY_LIMIT	128 * 1024 * 1024
  ------------------
  |  Branch (137:6): [True: 0, False: 323k]
  ------------------
  138|      0|	{
  139|      0|		libcerror_error_set(
  140|      0|		 error,
  141|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  142|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  143|      0|		 "%s: invalid entries size value exceeds maximum.",
  144|      0|		 function );
  145|       |
  146|      0|		goto on_error;
  147|      0|	}
  148|   323k|	internal_array->entries = (intptr_t **) memory_allocate(
  ------------------
  |  |   60|   323k|	malloc( size )
  ------------------
  149|   323k|	                                         entries_size );
  150|       |
  151|   323k|	if( internal_array->entries == NULL )
  ------------------
  |  Branch (151:6): [True: 0, False: 323k]
  ------------------
  152|      0|	{
  153|      0|		libcerror_error_set(
  154|      0|		 error,
  155|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
  156|      0|		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
  157|      0|		 "%s: unable to create array entries.",
  158|      0|		 function );
  159|       |
  160|      0|		goto on_error;
  161|      0|	}
  162|   323k|	if( memory_set(
  ------------------
  |  |  121|   323k|	memset( (void *) buffer, (int) value, count )
  ------------------
  |  Branch (162:6): [True: 0, False: 323k]
  ------------------
  163|   323k|	     internal_array->entries,
  164|   323k|	     0,
  165|   323k|	     entries_size ) == NULL )
  166|      0|	{
  167|      0|		libcerror_error_set(
  168|      0|		 error,
  169|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
  170|      0|		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
  171|      0|		 "%s: unable to clear array entries.",
  172|      0|		 function );
  173|       |
  174|      0|		goto on_error;
  175|      0|	}
  176|   323k|	internal_array->number_of_allocated_entries = number_of_allocated_entries;
  177|   323k|	internal_array->number_of_entries           = number_of_entries;
  178|       |
  179|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
  180|       |	if( libcthreads_read_write_lock_initialize(
  181|       |	     &( internal_array->read_write_lock ),
  182|       |	     error ) != 1 )
  183|       |	{
  184|       |		libcerror_error_set(
  185|       |		 error,
  186|       |		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  187|       |		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  188|       |		 "%s: unable to initialize read/write lock.",
  189|       |		 function );
  190|       |
  191|       |		goto on_error;
  192|       |	}
  193|       |#endif
  194|   323k|	*array = (libcdata_array_t *) internal_array;
  195|       |
  196|   323k|	return( 1 );
  197|       |
  198|      0|on_error:
  199|      0|	if( internal_array != NULL )
  ------------------
  |  Branch (199:6): [True: 0, False: 0]
  ------------------
  200|      0|	{
  201|      0|		if( internal_array->entries != NULL )
  ------------------
  |  Branch (201:7): [True: 0, False: 0]
  ------------------
  202|      0|		{
  203|      0|			memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  204|      0|			 internal_array->entries );
  205|      0|		}
  206|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  207|      0|		 internal_array );
  208|      0|	}
  209|      0|	return( -1 );
  210|   323k|}
libcdata_array_free:
  222|   323k|{
  223|   323k|	libcdata_internal_array_t *internal_array = NULL;
  224|   323k|	static char *function                     = "libcdata_array_free";
  225|   323k|	int result                                = 1;
  226|       |
  227|   323k|	if( array == NULL )
  ------------------
  |  Branch (227:6): [True: 0, False: 323k]
  ------------------
  228|      0|	{
  229|      0|		libcerror_error_set(
  230|      0|		 error,
  231|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  232|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  233|      0|		 "%s: invalid array.",
  234|      0|		 function );
  235|       |
  236|      0|		return( -1 );
  237|      0|	}
  238|   323k|	if( *array != NULL )
  ------------------
  |  Branch (238:6): [True: 323k, False: 0]
  ------------------
  239|   323k|	{
  240|   323k|		internal_array = (libcdata_internal_array_t *) *array;
  241|   323k|		*array         = NULL;
  242|       |
  243|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
  244|       |		if( libcthreads_read_write_lock_free(
  245|       |		     &( internal_array->read_write_lock ),
  246|       |		     error ) != 1 )
  247|       |		{
  248|       |			libcerror_error_set(
  249|       |			 error,
  250|       |			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  251|       |			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  252|       |			 "%s: unable to free read/write lock.",
  253|       |			 function );
  254|       |
  255|       |			result = -1;
  256|       |		}
  257|       |#endif
  258|   323k|		if( internal_array->entries != NULL )
  ------------------
  |  Branch (258:7): [True: 323k, False: 0]
  ------------------
  259|   323k|		{
  260|   323k|			if( libcdata_internal_array_clear(
  ------------------
  |  Branch (260:8): [True: 0, False: 323k]
  ------------------
  261|   323k|			     internal_array,
  262|   323k|			     entry_free_function,
  263|   323k|			     error ) != 1 )
  264|      0|			{
  265|      0|				libcerror_error_set(
  266|      0|				 error,
  267|      0|				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  268|      0|				 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  269|      0|				 "%s: unable to clear array.",
  270|      0|				 function );
  271|       |
  272|      0|				result = -1;
  273|      0|			}
  274|   323k|			memory_free(
  ------------------
  |  |  100|   323k|	free( (void *) buffer )
  ------------------
  275|   323k|			 internal_array->entries );
  276|   323k|		}
  277|   323k|		memory_free(
  ------------------
  |  |  100|   323k|	free( (void *) buffer )
  ------------------
  278|   323k|		 internal_array );
  279|   323k|	}
  280|   323k|	return( result );
  281|   323k|}
libcdata_array_empty:
  295|    668|{
  296|    668|	libcdata_internal_array_t *internal_array = NULL;
  297|    668|	static char *function                     = "libcdata_array_empty";
  298|    668|	int result                                = 1;
  299|       |
  300|    668|	if( array == NULL )
  ------------------
  |  Branch (300:6): [True: 0, False: 668]
  ------------------
  301|      0|	{
  302|      0|		libcerror_error_set(
  303|      0|		 error,
  304|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  305|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  306|      0|		 "%s: invalid array.",
  307|      0|		 function );
  308|       |
  309|      0|		return( -1 );
  310|      0|	}
  311|    668|	internal_array = (libcdata_internal_array_t *) array;
  312|       |
  313|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
  314|       |	if( libcthreads_read_write_lock_grab_for_write(
  315|       |	     internal_array->read_write_lock,
  316|       |	     error ) != 1 )
  317|       |	{
  318|       |		libcerror_error_set(
  319|       |		 error,
  320|       |		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  321|       |		 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
  322|       |		 "%s: unable to grab read/write lock for writing.",
  323|       |		 function );
  324|       |
  325|       |		return( -1 );
  326|       |	}
  327|       |#endif
  328|    668|	if( libcdata_internal_array_clear(
  ------------------
  |  Branch (328:6): [True: 0, False: 668]
  ------------------
  329|    668|	     internal_array,
  330|    668|	     entry_free_function,
  331|    668|	     error ) != 1 )
  332|      0|	{
  333|      0|		libcerror_error_set(
  334|      0|		 error,
  335|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  336|      0|		 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  337|      0|		 "%s: unable to clear array.",
  338|      0|		 function );
  339|       |
  340|      0|		result = -1;
  341|      0|	}
  342|    668|	else
  343|    668|	{
  344|    668|		internal_array->number_of_entries = 0;
  345|    668|	}
  346|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
  347|       |	if( libcthreads_read_write_lock_release_for_write(
  348|       |	     internal_array->read_write_lock,
  349|       |	     error ) != 1 )
  350|       |	{
  351|       |		libcerror_error_set(
  352|       |		 error,
  353|       |		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  354|       |		 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
  355|       |		 "%s: unable to release read/write lock for writing.",
  356|       |		 function );
  357|       |
  358|       |		return( -1 );
  359|       |	}
  360|       |#endif
  361|    668|	return( result );
  362|    668|}
libcdata_internal_array_clear:
  377|   323k|{
  378|   323k|	static char *function = "libcdata_internal_array_clear";
  379|   323k|	int entry_free_result = 0;
  380|   323k|	int entry_iterator    = 0;
  381|   323k|	int result            = 1;
  382|       |
  383|   323k|	if( internal_array == NULL )
  ------------------
  |  Branch (383:6): [True: 0, False: 323k]
  ------------------
  384|      0|	{
  385|      0|		libcerror_error_set(
  386|      0|		 error,
  387|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  388|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  389|      0|		 "%s: invalid array.",
  390|      0|		 function );
  391|       |
  392|      0|		return( -1 );
  393|      0|	}
  394|   323k|	if( internal_array->entries == NULL )
  ------------------
  |  Branch (394:6): [True: 0, False: 323k]
  ------------------
  395|      0|	{
  396|      0|		libcerror_error_set(
  397|      0|		 error,
  398|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  399|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
  400|      0|		 "%s: invalid array - missing entries.",
  401|      0|		 function );
  402|       |
  403|      0|		return( -1 );
  404|      0|	}
  405|   323k|	for( entry_iterator = 0;
  406|   650k|	     entry_iterator < internal_array->number_of_entries;
  ------------------
  |  Branch (406:7): [True: 326k, False: 323k]
  ------------------
  407|   326k|	     entry_iterator++ )
  408|   326k|	{
  409|   326k|		if( internal_array->entries[ entry_iterator ] != NULL )
  ------------------
  |  Branch (409:7): [True: 326k, False: 0]
  ------------------
  410|   326k|		{
  411|   326k|			if( entry_free_function == NULL )
  ------------------
  |  Branch (411:8): [True: 0, False: 326k]
  ------------------
  412|      0|			{
  413|      0|				entry_free_result = 1;
  414|      0|			}
  415|   326k|			else
  416|   326k|			{
  417|   326k|				entry_free_result = entry_free_function(
  418|   326k|				                     &( internal_array->entries[ entry_iterator ] ),
  419|   326k|				                     error );
  420|   326k|			}
  421|   326k|			if( entry_free_result != 1 )
  ------------------
  |  Branch (421:8): [True: 0, False: 326k]
  ------------------
  422|      0|			{
  423|      0|				libcerror_error_set(
  424|      0|				 error,
  425|      0|				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  426|      0|				 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  427|      0|				 "%s: unable to free array entry: %d.",
  428|      0|				 function,
  429|      0|				 entry_iterator );
  430|       |
  431|      0|				result = -1;
  432|      0|			}
  433|   326k|			else
  434|   326k|			{
  435|   326k|				internal_array->entries[ entry_iterator ] = NULL;
  436|   326k|			}
  437|   326k|		}
  438|   326k|	}
  439|   323k|	return( result );
  440|   323k|}
libcdata_internal_array_resize:
  712|   326k|{
  713|   326k|	static char *function           = "libcdata_internal_array_resize";
  714|   326k|	void *reallocation              = NULL;
  715|   326k|	size_t entries_size             = 0;
  716|   326k|	int entry_iterator              = 0;
  717|   326k|	int number_of_allocated_entries = 0;
  718|   326k|	int result                      = 1;
  719|       |
  720|   326k|	if( internal_array == NULL )
  ------------------
  |  Branch (720:6): [True: 0, False: 326k]
  ------------------
  721|      0|	{
  722|      0|		libcerror_error_set(
  723|      0|		 error,
  724|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  725|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  726|      0|		 "%s: invalid array.",
  727|      0|		 function );
  728|       |
  729|      0|		return( -1 );
  730|      0|	}
  731|   326k|	if( internal_array->entries == NULL )
  ------------------
  |  Branch (731:6): [True: 0, False: 326k]
  ------------------
  732|      0|	{
  733|      0|		libcerror_error_set(
  734|      0|		 error,
  735|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  736|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
  737|      0|		 "%s: invalid array - missing entries.",
  738|      0|		 function );
  739|       |
  740|      0|		return( -1 );
  741|      0|	}
  742|   326k|	if( number_of_entries < 0 )
  ------------------
  |  Branch (742:6): [True: 0, False: 326k]
  ------------------
  743|      0|	{
  744|      0|		libcerror_error_set(
  745|      0|		 error,
  746|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  747|      0|		 LIBCERROR_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO,
  748|      0|		 "%s: invalid number of entries value less than zero.",
  749|      0|		 function );
  750|       |
  751|      0|		return( -1 );
  752|      0|	}
  753|   326k|	if( number_of_entries > internal_array->number_of_allocated_entries )
  ------------------
  |  Branch (753:6): [True: 19.9k, False: 306k]
  ------------------
  754|  19.9k|	{
  755|       |		/* Pre-allocate in blocks of 16 entries
  756|       |		 */
  757|  19.9k|		if( number_of_entries >= (int) ( INT_MAX - 16 ) )
  ------------------
  |  Branch (757:7): [True: 0, False: 19.9k]
  ------------------
  758|      0|		{
  759|      0|			number_of_allocated_entries = INT_MAX;
  760|      0|		}
  761|  19.9k|		else
  762|  19.9k|		{
  763|  19.9k|			number_of_allocated_entries = ( number_of_entries & ~( 15 ) ) + 16;
  764|  19.9k|		}
  765|  19.9k|#if SIZEOF_INT <= SIZEOF_SIZE_T
  766|  19.9k|		if( (size_t) number_of_allocated_entries > (size_t) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
  ------------------
  |  Branch (766:7): [True: 0, False: 19.9k]
  ------------------
  767|       |#else
  768|       |		if( number_of_allocated_entries > (int) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
  769|       |#endif
  770|      0|		{
  771|      0|			libcerror_error_set(
  772|      0|			 error,
  773|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  774|      0|			 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  775|      0|			 "%s: invalid number of allocated entries value exceeds maximum.",
  776|      0|			 function );
  777|       |
  778|      0|			return( -1 );
  779|      0|		}
  780|  19.9k|		entries_size = sizeof( intptr_t * ) * number_of_allocated_entries;
  781|       |
  782|  19.9k|		if( entries_size > (size_t) LIBCDATA_ARRAY_ENTRIES_MEMORY_LIMIT )
  ------------------
  |  |   78|  19.9k|#define LIBCDATA_ARRAY_ENTRIES_MEMORY_LIMIT	128 * 1024 * 1024
  ------------------
  |  Branch (782:7): [True: 0, False: 19.9k]
  ------------------
  783|      0|		{
  784|      0|			libcerror_error_set(
  785|      0|			 error,
  786|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  787|      0|			 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  788|      0|			 "%s: invalid entries size value exceeds maximum.",
  789|      0|			 function );
  790|       |
  791|      0|			return( -1 );
  792|      0|		}
  793|  19.9k|		reallocation = memory_reallocate(
  ------------------
  |  |   85|  19.9k|	realloc( (void *) buffer, size )
  ------------------
  794|  19.9k|		                internal_array->entries,
  795|  19.9k|		                entries_size );
  796|       |
  797|  19.9k|		if( reallocation == NULL )
  ------------------
  |  Branch (797:7): [True: 0, False: 19.9k]
  ------------------
  798|      0|		{
  799|      0|			libcerror_error_set(
  800|      0|			 error,
  801|      0|			 LIBCERROR_ERROR_DOMAIN_MEMORY,
  802|      0|			 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
  803|      0|			 "%s: unable to resize array entries.",
  804|      0|			 function );
  805|       |
  806|      0|			return( -1 );
  807|      0|		}
  808|  19.9k|		internal_array->entries = (intptr_t **) reallocation;
  809|       |
  810|       |		/* Cannot use memset reliably here. The loop below will be removed
  811|       |		 * when memset is used and the code is optimized. Therefore the loop
  812|       |		 * is not executed when memset fails.
  813|       |		 */
  814|  19.9k|		for( entry_iterator = internal_array->number_of_allocated_entries;
  815|   339k|		     entry_iterator < number_of_allocated_entries;
  ------------------
  |  Branch (815:8): [True: 319k, False: 19.9k]
  ------------------
  816|   319k|		     entry_iterator++ )
  817|   319k|		{
  818|   319k|			internal_array->entries[ entry_iterator ] = NULL;
  819|   319k|		}
  820|  19.9k|		internal_array->number_of_allocated_entries = number_of_allocated_entries;
  821|  19.9k|		internal_array->number_of_entries           = number_of_entries;
  822|  19.9k|	}
  823|   306k|	else if( number_of_entries > internal_array->number_of_entries )
  ------------------
  |  Branch (823:11): [True: 306k, False: 0]
  ------------------
  824|   306k|	{
  825|   306k|		internal_array->number_of_entries = number_of_entries;
  826|   306k|	}
  827|      0|	else if( internal_array->entries != NULL )
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|      0|	{
  829|      0|		for( entry_iterator = number_of_entries;
  830|      0|		     entry_iterator < internal_array->number_of_entries;
  ------------------
  |  Branch (830:8): [True: 0, False: 0]
  ------------------
  831|      0|		     entry_iterator++ )
  832|      0|		{
  833|      0|			if( internal_array->entries[ entry_iterator ] != NULL )
  ------------------
  |  Branch (833:8): [True: 0, False: 0]
  ------------------
  834|      0|			{
  835|      0|				if( entry_free_function == NULL )
  ------------------
  |  Branch (835:9): [True: 0, False: 0]
  ------------------
  836|      0|				{
  837|      0|					libcerror_error_set(
  838|      0|					 error,
  839|      0|					 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  840|      0|					 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  841|      0|					 "%s: invalid entry free function.",
  842|      0|					 function );
  843|       |
  844|      0|					return( -1 );
  845|      0|				}
  846|      0|				if( entry_free_function(
  ------------------
  |  Branch (846:9): [True: 0, False: 0]
  ------------------
  847|      0|				     &( internal_array->entries[ entry_iterator ] ),
  848|      0|				     error ) != 1 )
  849|      0|				{
  850|      0|					libcerror_error_set(
  851|      0|					 error,
  852|      0|					 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  853|      0|					 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  854|      0|					 "%s: unable to free array entry: %d.",
  855|      0|					 function,
  856|      0|					 entry_iterator );
  857|       |
  858|      0|					result = -1;
  859|      0|				}
  860|      0|				internal_array->entries[ entry_iterator ] = NULL;
  861|      0|			}
  862|      0|		}
  863|      0|		internal_array->number_of_entries = number_of_entries;
  864|      0|	}
  865|   326k|	return( result );
  866|   326k|}
libcdata_array_append_entry:
 1545|   326k|{
 1546|   326k|	libcdata_internal_array_t *internal_array = NULL;
 1547|   326k|	static char *function                     = "libcdata_array_append_entry";
 1548|   326k|	int result                                = 0;
 1549|   326k|	int safe_entry_index                      = 0;
 1550|       |
 1551|   326k|	if( array == NULL )
  ------------------
  |  Branch (1551:6): [True: 0, False: 326k]
  ------------------
 1552|      0|	{
 1553|      0|		libcerror_error_set(
 1554|      0|		 error,
 1555|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
 1556|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
 1557|      0|		 "%s: invalid array.",
 1558|      0|		 function );
 1559|       |
 1560|      0|		return( -1 );
 1561|      0|	}
 1562|   326k|	internal_array = (libcdata_internal_array_t *) array;
 1563|       |
 1564|   326k|	if( internal_array->entries == NULL )
  ------------------
  |  Branch (1564:6): [True: 0, False: 326k]
  ------------------
 1565|      0|	{
 1566|      0|		libcerror_error_set(
 1567|      0|		 error,
 1568|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
 1569|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
 1570|      0|		 "%s: invalid array - missing entries.",
 1571|      0|		 function );
 1572|       |
 1573|      0|		return( -1 );
 1574|      0|	}
 1575|   326k|	if( entry_index == NULL )
  ------------------
  |  Branch (1575:6): [True: 0, False: 326k]
  ------------------
 1576|      0|	{
 1577|      0|		libcerror_error_set(
 1578|      0|		 error,
 1579|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
 1580|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
 1581|      0|		 "%s: invalid entry index.",
 1582|      0|		 function );
 1583|       |
 1584|      0|		return( -1 );
 1585|      0|	}
 1586|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
 1587|       |	if( libcthreads_read_write_lock_grab_for_write(
 1588|       |	     internal_array->read_write_lock,
 1589|       |	     error ) != 1 )
 1590|       |	{
 1591|       |		libcerror_error_set(
 1592|       |		 error,
 1593|       |		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
 1594|       |		 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
 1595|       |		 "%s: unable to grab read/write lock for writing.",
 1596|       |		 function );
 1597|       |
 1598|       |		return( -1 );
 1599|       |	}
 1600|       |#endif
 1601|   326k|	safe_entry_index = internal_array->number_of_entries;
 1602|       |
 1603|   326k|	result = libcdata_internal_array_resize(
 1604|   326k|	          internal_array,
 1605|   326k|	          internal_array->number_of_entries + 1,
 1606|   326k|	          NULL,
 1607|   326k|	          error );
 1608|       |
 1609|   326k|	if( result != 1 )
  ------------------
  |  Branch (1609:6): [True: 0, False: 326k]
  ------------------
 1610|      0|	{
 1611|      0|		libcerror_error_set(
 1612|      0|		 error,
 1613|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
 1614|      0|		 LIBCERROR_RUNTIME_ERROR_RESIZE_FAILED,
 1615|      0|		 "%s: unable to resize array.",
 1616|      0|		 function );
 1617|       |
 1618|      0|		result = -1;
 1619|      0|	}
 1620|   326k|	else
 1621|   326k|	{
 1622|   326k|		internal_array->entries[ safe_entry_index ] = entry;
 1623|   326k|	}
 1624|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
 1625|       |	if( libcthreads_read_write_lock_release_for_write(
 1626|       |	     internal_array->read_write_lock,
 1627|       |	     error ) != 1 )
 1628|       |	{
 1629|       |		libcerror_error_set(
 1630|       |		 error,
 1631|       |		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
 1632|       |		 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
 1633|       |		 "%s: unable to release read/write lock for writing.",
 1634|       |		 function );
 1635|       |
 1636|       |		goto on_error;
 1637|       |	}
 1638|       |#endif
 1639|   326k|	if( result == 1 )
  ------------------
  |  Branch (1639:6): [True: 326k, False: 0]
  ------------------
 1640|   326k|	{
 1641|   326k|		*entry_index = safe_entry_index;
 1642|   326k|	}
 1643|   326k|	return( result );
 1644|       |
 1645|       |#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
 1646|       |on_error:
 1647|       |	if( result == 1 )
 1648|       |	{
 1649|       |		internal_array->entries[ safe_entry_index ] = NULL;
 1650|       |
 1651|       |		internal_array->number_of_entries -= 1;
 1652|       |	}
 1653|       |	return( -1 );
 1654|       |#endif
 1655|   326k|}

libcerror_error_set:
  314|  1.40k|{
  315|  1.40k|	va_list argument_list;
  316|       |
  317|  1.40k|	libcerror_internal_error_t *internal_error = NULL;
  318|  1.40k|	system_character_t *error_string           = NULL;
  319|  1.40k|	system_character_t *system_format_string   = NULL;
  320|  1.40k|	void *reallocation                         = NULL;
  321|  1.40k|	size_t error_string_size                   = 0;
  322|  1.40k|	size_t format_string_length                = 0;
  323|  1.40k|	size_t message_size                        = 0;
  324|  1.40k|	size_t next_message_size                   = LIBCERROR_MESSAGE_INCREMENT_SIZE;
  ------------------
  |  |  322|  1.40k|#define LIBCERROR_MESSAGE_INCREMENT_SIZE		64
  ------------------
  325|  1.40k|	int message_index                          = 0;
  326|  1.40k|	int print_count                            = 0;
  327|       |
  328|  1.40k|	if( error == NULL )
  ------------------
  |  Branch (328:6): [True: 1.40k, False: 0]
  ------------------
  329|  1.40k|	{
  330|  1.40k|		return;
  331|  1.40k|	}
  332|      0|	if( format_string == NULL )
  ------------------
  |  Branch (332:6): [True: 0, False: 0]
  ------------------
  333|      0|	{
  334|      0|		return;
  335|      0|	}
  336|      0|	format_string_length = narrow_string_length(
  ------------------
  |  |   59|      0|	strlen( string )
  ------------------
  337|      0|	                        format_string );
  338|       |
  339|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  340|       |	libcerror_error_get_system_format_string(
  341|       |	 format_string,
  342|       |	 format_string_length,
  343|       |	 &system_format_string );
  344|       |
  345|       |	if( system_format_string == NULL )
  346|       |	{
  347|       |		return;
  348|       |	}
  349|       |#else
  350|      0|	system_format_string = (system_character_t *) format_string;
  351|      0|#endif
  352|      0|	if( *error == NULL )
  ------------------
  |  Branch (352:6): [True: 0, False: 0]
  ------------------
  353|      0|	{
  354|      0|		if( libcerror_error_initialize(
  ------------------
  |  Branch (354:7): [True: 0, False: 0]
  ------------------
  355|      0|		     error,
  356|      0|		     error_domain,
  357|      0|		     error_code ) != 1 )
  358|      0|		{
  359|      0|			goto on_error;
  360|      0|		}
  361|      0|	}
  362|      0|	internal_error = (libcerror_internal_error_t *) *error;
  363|       |
  364|      0|	if( libcerror_error_resize(
  ------------------
  |  Branch (364:6): [True: 0, False: 0]
  ------------------
  365|      0|	     internal_error ) != 1 )
  366|      0|	{
  367|      0|		goto on_error;
  368|      0|	}
  369|      0|	if( format_string_length > next_message_size )
  ------------------
  |  Branch (369:6): [True: 0, False: 0]
  ------------------
  370|      0|	{
  371|      0|		next_message_size = ( ( format_string_length / LIBCERROR_MESSAGE_INCREMENT_SIZE ) + 1 )
  ------------------
  |  |  322|      0|#define LIBCERROR_MESSAGE_INCREMENT_SIZE		64
  ------------------
  372|      0|		                  * LIBCERROR_MESSAGE_INCREMENT_SIZE;
  ------------------
  |  |  322|      0|#define LIBCERROR_MESSAGE_INCREMENT_SIZE		64
  ------------------
  373|      0|	}
  374|      0|	do
  375|      0|	{
  376|      0|		if( next_message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE )
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  |  Branch (376:7): [True: 0, False: 0]
  ------------------
  377|      0|		{
  378|      0|			next_message_size = LIBCERROR_MESSAGE_MAXIMUM_SIZE;
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  379|      0|		}
  380|      0|		reallocation = memory_reallocate(
  ------------------
  |  |   85|      0|	realloc( (void *) buffer, size )
  ------------------
  381|      0|		                error_string,
  382|      0|		                sizeof( system_character_t ) * next_message_size );
  383|       |
  384|      0|		if( reallocation == NULL )
  ------------------
  |  Branch (384:7): [True: 0, False: 0]
  ------------------
  385|      0|		{
  386|      0|			memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  387|      0|			 error_string );
  388|       |
  389|      0|			goto on_error;
  390|      0|		}
  391|      0|		error_string = (system_character_t *) reallocation;
  392|       |
  393|      0|		message_size = next_message_size;
  394|       |
  395|       |		/* argument_list cannot be reused in successive calls to vsnprintf
  396|       |		 */
  397|      0|		VASTART(
  ------------------
  |  |  289|      0|        va_start( argument_list, name )
  ------------------
  398|      0|		 argument_list,
  399|      0|		 const char *,
  400|      0|		 format_string );
  401|       |
  402|      0|		print_count = system_string_vsnprintf(
  ------------------
  |  |  141|      0|	narrow_string_vsnprintf( string, size, format, __VA_ARGS__ )
  |  |  ------------------
  |  |  |  |  179|      0|	vsnprintf( string, size, format, __VA_ARGS__ )
  |  |  ------------------
  ------------------
  403|      0|		               error_string,
  404|      0|		               message_size,
  405|      0|		               system_format_string,
  406|      0|		               argument_list );
  407|       |
  408|      0|		VAEND(
  ------------------
  |  |  291|      0|        va_end( argument_list )
  ------------------
  409|      0|		 argument_list );
  410|       |
  411|      0|		if( print_count <= -1 )
  ------------------
  |  Branch (411:7): [True: 0, False: 0]
  ------------------
  412|      0|		{
  413|      0|			next_message_size += LIBCERROR_MESSAGE_INCREMENT_SIZE;
  ------------------
  |  |  322|      0|#define LIBCERROR_MESSAGE_INCREMENT_SIZE		64
  ------------------
  414|      0|		}
  415|      0|		else if( ( (size_t) print_count >= message_size )
  ------------------
  |  Branch (415:12): [True: 0, False: 0]
  ------------------
  416|      0|		      || ( error_string[ print_count ] != (system_character_t) 0 ) )
  ------------------
  |  Branch (416:12): [True: 0, False: 0]
  ------------------
  417|      0|		{
  418|      0|			next_message_size = (size_t) ( print_count + 1 );
  419|      0|			print_count       = -1;
  420|      0|		}
  421|      0|		else
  422|      0|		{
  423|      0|			error_string_size = (size_t) print_count + 1;
  424|      0|		}
  425|      0|		if( message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE )
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  |  Branch (425:7): [True: 0, False: 0]
  ------------------
  426|      0|		{
  427|      0|			break;
  428|      0|		}
  429|      0|	}
  430|      0|	while( print_count <= -1 );
  ------------------
  |  Branch (430:9): [True: 0, False: 0]
  ------------------
  431|       |
  432|      0|	if( message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE )
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  |  Branch (432:6): [True: 0, False: 0]
  ------------------
  433|      0|	{
  434|      0|		error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 4 ] = (system_character_t) '.';
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  435|      0|		error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 3 ] = (system_character_t) '.';
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  436|      0|		error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 2 ] = (system_character_t) '.';
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  437|      0|		error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 1 ] = 0;
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  438|      0|		error_string_size                                  = (size_t) LIBCERROR_MESSAGE_MAXIMUM_SIZE;
  ------------------
  |  |  323|      0|#define LIBCERROR_MESSAGE_MAXIMUM_SIZE			4096
  ------------------
  439|      0|	}
  440|      0|	message_index = internal_error->number_of_messages - 1;
  441|       |
  442|      0|	internal_error->messages[ message_index ] = error_string;
  443|      0|	internal_error->sizes[ message_index ]    = error_string_size;
  444|       |
  445|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  446|       |	memory_free(
  447|       |	 system_format_string );
  448|       |
  449|       |	system_format_string = NULL;
  450|       |#endif
  451|      0|	return;
  452|       |
  453|      0|on_error:
  454|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  455|       |	if( system_format_string != NULL )
  456|       |	{
  457|       |		memory_free(
  458|       |		 system_format_string );
  459|       |	}
  460|       |#endif
  461|      0|	return;
  462|      0|}

libfwps_record_initialize:
   46|  4.92k|{
   47|  4.92k|	libfwps_internal_record_t *internal_record = NULL;
   48|  4.92k|	static char *function                      = "libfwps_record_initialize";
   49|       |
   50|  4.92k|	if( record == NULL )
  ------------------
  |  Branch (50:6): [True: 0, False: 4.92k]
  ------------------
   51|      0|	{
   52|      0|		libcerror_error_set(
   53|      0|		 error,
   54|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
   55|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
   56|      0|		 "%s: invalid record.",
   57|      0|		 function );
   58|       |
   59|      0|		return( -1 );
   60|      0|	}
   61|  4.92k|	if( *record != NULL )
  ------------------
  |  Branch (61:6): [True: 0, False: 4.92k]
  ------------------
   62|      0|	{
   63|      0|		libcerror_error_set(
   64|      0|		 error,
   65|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
   66|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
   67|      0|		 "%s: invalid record value already set.",
   68|      0|		 function );
   69|       |
   70|      0|		return( -1 );
   71|      0|	}
   72|  4.92k|	if( ( record_type != LIBFWPS_RECORD_TYPE_NAMED )
  ------------------
  |  Branch (72:6): [True: 4.05k, False: 869]
  ------------------
   73|  4.92k|	 && ( record_type != LIBFWPS_RECORD_TYPE_NUMERIC ) )
  ------------------
  |  Branch (73:6): [True: 0, False: 4.05k]
  ------------------
   74|      0|	{
   75|      0|		libcerror_error_set(
   76|      0|		 error,
   77|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
   78|      0|		 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
   79|      0|		 "%s: unsupported record type.",
   80|      0|		 function );
   81|       |
   82|      0|		return( -1 );
   83|      0|	}
   84|  4.92k|	internal_record = memory_allocate_structure(
  ------------------
  |  |   64|  4.92k|	(type *) memory_allocate( sizeof( type ) )
  |  |  ------------------
  |  |  |  |   60|  4.92k|	malloc( size )
  |  |  ------------------
  ------------------
   85|  4.92k|	                   libfwps_internal_record_t );
   86|       |
   87|  4.92k|	if( internal_record == NULL )
  ------------------
  |  Branch (87:6): [True: 0, False: 4.92k]
  ------------------
   88|      0|	{
   89|      0|		libcerror_error_set(
   90|      0|		 error,
   91|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   92|      0|		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
   93|      0|		 "%s: unable to create record.",
   94|      0|		 function );
   95|       |
   96|      0|		goto on_error;
   97|      0|	}
   98|  4.92k|	if( memory_set(
  ------------------
  |  |  121|  4.92k|	memset( (void *) buffer, (int) value, count )
  ------------------
  |  Branch (98:6): [True: 0, False: 4.92k]
  ------------------
   99|  4.92k|	     internal_record,
  100|  4.92k|	     0,
  101|  4.92k|	     sizeof( libfwps_internal_record_t ) ) == NULL )
  102|      0|	{
  103|      0|		libcerror_error_set(
  104|      0|		 error,
  105|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
  106|      0|		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
  107|      0|		 "%s: unable to clear record.",
  108|      0|		 function );
  109|       |
  110|      0|		goto on_error;
  111|      0|	}
  112|  4.92k|	internal_record->type = record_type;
  113|       |
  114|  4.92k|	*record = (libfwps_record_t *) internal_record;
  115|       |
  116|  4.92k|	return( 1 );
  117|       |
  118|      0|on_error:
  119|      0|	if( internal_record != NULL )
  ------------------
  |  Branch (119:6): [True: 0, False: 0]
  ------------------
  120|      0|	{
  121|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  122|      0|		 internal_record );
  123|      0|	}
  124|      0|	return( -1 );
  125|  4.92k|}
libfwps_internal_record_free:
  160|  4.92k|{
  161|  4.92k|	static char *function = "libfwps_internal_record_free";
  162|       |
  163|  4.92k|	if( internal_record == NULL )
  ------------------
  |  Branch (163:6): [True: 0, False: 4.92k]
  ------------------
  164|      0|	{
  165|      0|		libcerror_error_set(
  166|      0|		 error,
  167|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  168|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  169|      0|		 "%s: invalid internal record.",
  170|      0|		 function );
  171|       |
  172|      0|		return( -1 );
  173|      0|	}
  174|  4.92k|	if( *internal_record != NULL )
  ------------------
  |  Branch (174:6): [True: 4.92k, False: 0]
  ------------------
  175|  4.92k|	{
  176|  4.92k|		if( ( *internal_record )->value_data != NULL )
  ------------------
  |  Branch (176:7): [True: 3.81k, False: 1.10k]
  ------------------
  177|  3.81k|		{
  178|  3.81k|			memory_free(
  ------------------
  |  |  100|  3.81k|	free( (void *) buffer )
  ------------------
  179|  3.81k|			 ( *internal_record )->value_data );
  180|  3.81k|		}
  181|  4.92k|		memory_free(
  ------------------
  |  |  100|  4.92k|	free( (void *) buffer )
  ------------------
  182|  4.92k|		 *internal_record );
  183|       |
  184|  4.92k|		*internal_record = NULL;
  185|  4.92k|	}
  186|  4.92k|	return( 1 );
  187|  4.92k|}
libfwps_record_copy_from_byte_stream:
  198|  4.92k|{
  199|  4.92k|	libfwps_internal_record_t *internal_record = NULL;
  200|  4.92k|	static char *function                      = "libfwps_record_copy_from_byte_stream";
  201|  4.92k|	size_t byte_stream_offset                  = 0;
  202|  4.92k|	uint32_t name_size                         = 0;
  203|       |
  204|       |#if defined( HAVE_DEBUG_OUTPUT )
  205|       |	system_character_t *value_string           = NULL;
  206|       |	size_t value_string_size                   = 0;
  207|       |	int result                                 = 0;
  208|       |#endif
  209|       |
  210|  4.92k|	if( record == NULL )
  ------------------
  |  Branch (210:6): [True: 0, False: 4.92k]
  ------------------
  211|      0|	{
  212|      0|		libcerror_error_set(
  213|      0|		 error,
  214|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  215|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  216|      0|		 "%s: invalid record.",
  217|      0|		 function );
  218|       |
  219|      0|		return( -1 );
  220|      0|	}
  221|  4.92k|	internal_record = (libfwps_internal_record_t *) record;
  222|       |
  223|  4.92k|	if( internal_record->value_data != NULL )
  ------------------
  |  Branch (223:6): [True: 0, False: 4.92k]
  ------------------
  224|      0|	{
  225|      0|		libcerror_error_set(
  226|      0|		 error,
  227|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  228|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
  229|      0|		 "%s: invalid record - value data already set.",
  230|      0|		 function );
  231|       |
  232|      0|		return( -1 );
  233|      0|	}
  234|  4.92k|	if( byte_stream == NULL )
  ------------------
  |  Branch (234:6): [True: 0, False: 4.92k]
  ------------------
  235|      0|	{
  236|      0|		libcerror_error_set(
  237|      0|		 error,
  238|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  239|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  240|      0|		 "%s: invalid byte stream.",
  241|      0|		 function );
  242|       |
  243|      0|		return( -1 );
  244|      0|	}
  245|  4.92k|	if( ( byte_stream_size < 13 )
  ------------------
  |  Branch (245:6): [True: 29, False: 4.89k]
  ------------------
  246|  4.92k|	 || ( byte_stream_size > (size_t) SSIZE_MAX ) )
  ------------------
  |  Branch (246:6): [True: 0, False: 4.89k]
  ------------------
  247|     29|	{
  248|     29|		libcerror_error_set(
  249|     29|		 error,
  250|     29|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  251|     29|		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
  252|     29|		 "%s: invalid byte stream size value out of bounds.",
  253|     29|		 function );
  254|       |
  255|     29|		return( -1 );
  256|     29|	}
  257|  4.89k|	byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|  4.89k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|  4.89k|	( value ) <<= 8; \
  |  |   90|  4.89k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|  4.89k|	( value ) <<= 8; \
  |  |   92|  4.89k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|  4.89k|	( value ) <<= 8; \
  |  |   94|  4.89k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  258|  4.89k|	 byte_stream,
  259|  4.89k|	 internal_record->size );
  260|       |
  261|  4.89k|	if( ( internal_record->size < 13 )
  ------------------
  |  Branch (261:6): [True: 0, False: 4.89k]
  ------------------
  262|  4.89k|	 || ( (size_t) internal_record->size > byte_stream_size ) )
  ------------------
  |  Branch (262:6): [True: 0, False: 4.89k]
  ------------------
  263|      0|	{
  264|      0|		libcerror_error_set(
  265|      0|		 error,
  266|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  267|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  268|      0|		 "%s: invalid record - size value out of bounds.",
  269|      0|		 function );
  270|       |
  271|      0|		goto on_error;
  272|      0|	}
  273|       |#if defined( HAVE_DEBUG_OUTPUT )
  274|       |	if( libcnotify_verbose != 0 )
  275|       |	{
  276|       |		libcnotify_printf(
  277|       |		 "%s: record data:\n",
  278|       |		 function );
  279|       |		libcnotify_print_data(
  280|       |		 byte_stream,
  281|       |		 internal_record->size,
  282|       |		 LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA );
  283|       |	}
  284|       |#endif
  285|  4.89k|	if( internal_record->type == LIBFWPS_RECORD_TYPE_NAMED )
  ------------------
  |  Branch (285:6): [True: 862, False: 4.03k]
  ------------------
  286|    862|	{
  287|    862|		byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|    862|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|    862|	( value ) <<= 8; \
  |  |   90|    862|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|    862|	( value ) <<= 8; \
  |  |   92|    862|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|    862|	( value ) <<= 8; \
  |  |   94|    862|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  288|    862|		 &( byte_stream[ byte_stream_offset + 4 ] ),
  289|    862|		 name_size );
  290|    862|	}
  291|  4.03k|	else if( internal_record->type == LIBFWPS_RECORD_TYPE_NUMERIC )
  ------------------
  |  Branch (291:11): [True: 4.03k, False: 0]
  ------------------
  292|  4.03k|	{
  293|  4.03k|		byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|  4.03k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|  4.03k|	( value ) <<= 8; \
  |  |   90|  4.03k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|  4.03k|	( value ) <<= 8; \
  |  |   92|  4.03k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|  4.03k|	( value ) <<= 8; \
  |  |   94|  4.03k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  294|  4.03k|		 &( byte_stream[ byte_stream_offset + 4 ] ),
  295|  4.03k|		 internal_record->entry_type );
  296|  4.03k|	}
  297|       |#if defined( HAVE_DEBUG_OUTPUT )
  298|       |	if( libcnotify_verbose != 0 )
  299|       |	{
  300|       |		libcnotify_printf(
  301|       |		 "%s: size\t\t\t\t: %" PRIu32 "\n",
  302|       |		 function,
  303|       |		 internal_record->size );
  304|       |
  305|       |		if( internal_record->type == LIBFWPS_RECORD_TYPE_NAMED )
  306|       |		{
  307|       |			libcnotify_printf(
  308|       |			 "%s: name size\t\t\t\t: %" PRIu32 "\n",
  309|       |			 function,
  310|       |			 name_size );
  311|       |		}
  312|       |		else
  313|       |		{
  314|       |			libcnotify_printf(
  315|       |			 "%s: entry type\t\t\t: %" PRIu32 "\n",
  316|       |			 function,
  317|       |			 internal_record->entry_type );
  318|       |		}
  319|       |		libcnotify_printf(
  320|       |		 "%s: unknown1\t\t\t\t: 0x%02" PRIx8 "\n",
  321|       |		 function,
  322|       |		 byte_stream[ byte_stream_offset + 8 ] );
  323|       |	}
  324|       |#endif /* defined( HAVE_DEBUG_OUTPUT ) */
  325|       |
  326|  4.89k|	byte_stream_offset += 9;
  327|       |
  328|  4.89k|	if( internal_record->type == LIBFWPS_RECORD_TYPE_NAMED )
  ------------------
  |  Branch (328:6): [True: 862, False: 4.03k]
  ------------------
  329|    862|	{
  330|    862|		if( ( name_size > byte_stream_size )
  ------------------
  |  Branch (330:7): [True: 46, False: 816]
  ------------------
  331|    862|		 || ( byte_stream_offset > ( byte_stream_size - name_size ) ) )
  ------------------
  |  Branch (331:7): [True: 5, False: 811]
  ------------------
  332|     51|		{
  333|     51|			libcerror_error_set(
  334|     51|			 error,
  335|     51|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  336|     51|			 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  337|     51|			 "%s: invalid name size value out of bounds.",
  338|     51|			 function );
  339|       |
  340|     51|			goto on_error;
  341|     51|		}
  342|       |#if defined( HAVE_DEBUG_OUTPUT )
  343|       |		if( libcnotify_verbose != 0 )
  344|       |		{
  345|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  346|       |			result = libuna_utf16_string_size_from_utf16_stream(
  347|       |				  &( byte_stream[ byte_stream_offset ] ),
  348|       |				  name_size,
  349|       |				  LIBUNA_ENDIAN_LITTLE,
  350|       |				  &value_string_size,
  351|       |				  error );
  352|       |#else
  353|       |			result = libuna_utf8_string_size_from_utf16_stream(
  354|       |				  &( byte_stream[ byte_stream_offset ] ),
  355|       |				  name_size,
  356|       |				  LIBUNA_ENDIAN_LITTLE,
  357|       |				  &value_string_size,
  358|       |				  error );
  359|       |#endif
  360|       |			if( result != 1 )
  361|       |			{
  362|       |				libcerror_error_set(
  363|       |				 error,
  364|       |				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  365|       |				 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
  366|       |				 "%s: unable to determine size of URI string.",
  367|       |				 function );
  368|       |
  369|       |				goto on_error;
  370|       |			}
  371|       |			if( value_string_size > (size_t) ( SSIZE_MAX / sizeof( system_character_t ) ) )
  372|       |			{
  373|       |				libcerror_error_set(
  374|       |				 error,
  375|       |				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  376|       |				 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  377|       |				 "%s: invalid URI string size value exceeds maximum.",
  378|       |				 function );
  379|       |
  380|       |				goto on_error;
  381|       |			}
  382|       |			value_string = system_string_allocate(
  383|       |					value_string_size );
  384|       |
  385|       |			if( value_string == NULL )
  386|       |			{
  387|       |				libcerror_error_set(
  388|       |				 error,
  389|       |				 LIBCERROR_ERROR_DOMAIN_MEMORY,
  390|       |				 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
  391|       |				 "%s: unable to create URI string.",
  392|       |				 function );
  393|       |
  394|       |				goto on_error;
  395|       |			}
  396|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  397|       |			result = libuna_utf16_string_copy_from_utf16_stream(
  398|       |				  (libuna_utf16_character_t *) value_string,
  399|       |				  value_string_size,
  400|       |				  &( byte_stream[ byte_stream_offset ] ),
  401|       |				  name_size,
  402|       |				  LIBUNA_ENDIAN_LITTLE,
  403|       |				  error );
  404|       |#else
  405|       |			result = libuna_utf8_string_copy_from_utf16_stream(
  406|       |				  (libuna_utf8_character_t *) value_string,
  407|       |				  value_string_size,
  408|       |				  &( byte_stream[ byte_stream_offset ] ),
  409|       |				  name_size,
  410|       |				  LIBUNA_ENDIAN_LITTLE,
  411|       |				  error );
  412|       |#endif
  413|       |			if( result != 1 )
  414|       |			{
  415|       |				libcerror_error_set(
  416|       |				 error,
  417|       |				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  418|       |				 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
  419|       |				 "%s: unable to set URI string.",
  420|       |				 function );
  421|       |
  422|       |				goto on_error;
  423|       |			}
  424|       |			libcnotify_printf(
  425|       |			 "%s: name\t\t\t\t: %" PRIs_SYSTEM "\n",
  426|       |			 function,
  427|       |			 value_string );
  428|       |
  429|       |			memory_free(
  430|       |			 value_string );
  431|       |
  432|       |			value_string = NULL;
  433|       |		}
  434|       |#endif /* defined( HAVE_DEBUG_OUTPUT ) */
  435|       |
  436|    811|		byte_stream_offset += name_size;
  437|    811|	}
  438|  4.84k|	if( byte_stream_offset > ( byte_stream_size - 4 ) )
  ------------------
  |  Branch (438:6): [True: 7, False: 4.83k]
  ------------------
  439|      7|	{
  440|      7|		libcerror_error_set(
  441|      7|		 error,
  442|      7|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  443|      7|		 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
  444|      7|		 "%s: invalid byte stream size value too small.",
  445|      7|		 function );
  446|       |
  447|      7|		goto on_error;
  448|      7|	}
  449|  4.83k|	byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|  4.83k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|  4.83k|	( value ) <<= 8; \
  |  |   90|  4.83k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|  4.83k|	( value ) <<= 8; \
  |  |   92|  4.83k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|  4.83k|	( value ) <<= 8; \
  |  |   94|  4.83k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  450|  4.83k|	 &( byte_stream[ byte_stream_offset ] ),
  451|  4.83k|	 internal_record->value_type );
  452|       |
  453|  4.83k|	byte_stream_offset += 4;
  454|       |
  455|       |#if defined( HAVE_DEBUG_OUTPUT )
  456|       |	if( libcnotify_verbose != 0 )
  457|       |	{
  458|       |		libcnotify_printf(
  459|       |		 "%s: value type\t\t\t: %" PRIu32 "\n",
  460|       |		 function,
  461|       |		 internal_record->value_type );
  462|       |	}
  463|       |#endif
  464|  4.83k|	switch( internal_record->value_type )
  465|  4.83k|	{
  466|    250|		case LIBFWPS_VALUE_TYPE_BOOLEAN:
  ------------------
  |  Branch (466:3): [True: 250, False: 4.58k]
  ------------------
  467|    730|		case LIBFWPS_VALUE_TYPE_INTEGER_8BIT_SIGNED:
  ------------------
  |  Branch (467:3): [True: 480, False: 4.35k]
  ------------------
  468|  1.16k|		case LIBFWPS_VALUE_TYPE_INTEGER_8BIT_UNSIGNED:
  ------------------
  |  Branch (468:3): [True: 435, False: 4.39k]
  ------------------
  469|  1.16k|			internal_record->value_data_size = 1;
  470|  1.16k|			break;
  471|       |
  472|    238|		case LIBFWPS_VALUE_TYPE_INTEGER_16BIT_SIGNED:
  ------------------
  |  Branch (472:3): [True: 238, False: 4.59k]
  ------------------
  473|    606|		case LIBFWPS_VALUE_TYPE_INTEGER_16BIT_UNSIGNED:
  ------------------
  |  Branch (473:3): [True: 368, False: 4.46k]
  ------------------
  474|    606|			internal_record->value_data_size = 2;
  475|    606|			break;
  476|       |
  477|    201|		case LIBFWPS_VALUE_TYPE_FLOAT_32BIT:
  ------------------
  |  Branch (477:3): [True: 201, False: 4.63k]
  ------------------
  478|    397|		case LIBFWPS_VALUE_TYPE_INTEGER_32BIT_SIGNED:
  ------------------
  |  Branch (478:3): [True: 196, False: 4.63k]
  ------------------
  479|    592|		case LIBFWPS_VALUE_TYPE_INTEGER_32BIT_UNSIGNED:
  ------------------
  |  Branch (479:3): [True: 195, False: 4.63k]
  ------------------
  480|    592|			internal_record->value_data_size = 4;
  481|    592|			break;
  482|       |
  483|    207|		case LIBFWPS_VALUE_TYPE_CURRENCY:
  ------------------
  |  Branch (483:3): [True: 207, False: 4.62k]
  ------------------
  484|    415|		case LIBFWPS_VALUE_TYPE_DOUBLE_64BIT:
  ------------------
  |  Branch (484:3): [True: 208, False: 4.62k]
  ------------------
  485|    619|		case LIBFWPS_VALUE_TYPE_FILETIME:
  ------------------
  |  Branch (485:3): [True: 204, False: 4.63k]
  ------------------
  486|    816|		case LIBFWPS_VALUE_TYPE_INTEGER_64BIT_SIGNED:
  ------------------
  |  Branch (486:3): [True: 197, False: 4.63k]
  ------------------
  487|  1.04k|		case LIBFWPS_VALUE_TYPE_INTEGER_64BIT_UNSIGNED:
  ------------------
  |  Branch (487:3): [True: 227, False: 4.60k]
  ------------------
  488|  1.04k|			internal_record->value_data_size = 8;
  489|  1.04k|			break;
  490|       |
  491|    200|		case LIBFWPS_VALUE_TYPE_FIXED_POINT_128BIT:
  ------------------
  |  Branch (491:3): [True: 200, False: 4.63k]
  ------------------
  492|    397|		case LIBFWPS_VALUE_TYPE_GUID:
  ------------------
  |  Branch (492:3): [True: 197, False: 4.63k]
  ------------------
  493|    397|			internal_record->value_data_size = 16;
  494|    397|			break;
  495|       |
  496|    309|		case LIBFWPS_VALUE_TYPE_BINARY_STRING:
  ------------------
  |  Branch (496:3): [True: 309, False: 4.52k]
  ------------------
  497|    620|		case LIBFWPS_VALUE_TYPE_STRING_ASCII:
  ------------------
  |  Branch (497:3): [True: 311, False: 4.52k]
  ------------------
  498|    993|		case LIBFWPS_VALUE_TYPE_STRING_UNICODE:
  ------------------
  |  Branch (498:3): [True: 373, False: 4.46k]
  ------------------
  499|    993|			internal_record->value_data_size = 0;
  500|    993|			break;
  501|       |
  502|     38|		default:
  ------------------
  |  Branch (502:3): [True: 38, False: 4.79k]
  ------------------
  503|     38|			libcerror_error_set(
  504|     38|			 error,
  505|     38|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  506|     38|			 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
  507|     38|			 "%s: invalid record entry - unsupported value type.",
  508|     38|			 function );
  509|       |
  510|     38|			goto on_error;
  511|  4.83k|	}
  512|  4.79k|	if( internal_record->value_data_size == 0 )
  ------------------
  |  Branch (512:6): [True: 993, False: 3.80k]
  ------------------
  513|    993|	{
  514|    993|		if( byte_stream_offset > ( byte_stream_size - 4 ) )
  ------------------
  |  Branch (514:7): [True: 8, False: 985]
  ------------------
  515|      8|		{
  516|      8|			libcerror_error_set(
  517|      8|			 error,
  518|      8|			 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  519|      8|			 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
  520|      8|			 "%s: invalid byte stream size value too small.",
  521|      8|			 function );
  522|       |
  523|      8|			goto on_error;
  524|      8|		}
  525|    985|		byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|    985|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|    985|	( value ) <<= 8; \
  |  |   90|    985|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|    985|	( value ) <<= 8; \
  |  |   92|    985|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|    985|	( value ) <<= 8; \
  |  |   94|    985|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  526|    985|		 &( byte_stream[ byte_stream_offset ] ),
  527|    985|		 internal_record->value_data_size );
  528|       |
  529|    985|		byte_stream_offset += 4;
  530|       |
  531|    985|		if( internal_record->value_type == LIBFWPS_VALUE_TYPE_STRING_UNICODE )
  ------------------
  |  Branch (531:7): [True: 368, False: 617]
  ------------------
  532|    368|		{
  533|    368|			internal_record->value_data_size *= 2;
  534|    368|		}
  535|    985|	}
  536|       |#if defined( HAVE_DEBUG_OUTPUT )
  537|       |	if( libcnotify_verbose != 0 )
  538|       |	{
  539|       |		libcnotify_printf(
  540|       |		 "%s: value data size\t\t\t: %" PRIu32 "\n",
  541|       |		 function,
  542|       |		 internal_record->value_data_size );
  543|       |	}
  544|       |#endif
  545|  4.78k|	if( internal_record->value_data_size > 0 )
  ------------------
  |  Branch (545:6): [True: 3.93k, False: 854]
  ------------------
  546|  3.93k|	{
  547|  3.93k|		if( ( internal_record->value_data_size > byte_stream_size )
  ------------------
  |  Branch (547:7): [True: 80, False: 3.85k]
  ------------------
  548|  3.93k|		 || ( byte_stream_offset > ( byte_stream_size - internal_record->value_data_size ) ) )
  ------------------
  |  Branch (548:7): [True: 42, False: 3.81k]
  ------------------
  549|    122|		{
  550|    122|			libcerror_error_set(
  551|    122|			 error,
  552|    122|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  553|    122|			 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  554|    122|			 "%s: invalid valud data size value out of bounds.",
  555|    122|			 function );
  556|       |
  557|    122|			goto on_error;
  558|    122|		}
  559|       |#if defined( HAVE_DEBUG_OUTPUT )
  560|       |		if( libcnotify_verbose != 0 )
  561|       |		{
  562|       |			libcnotify_printf(
  563|       |			 "%s: value data:\n",
  564|       |			 function );
  565|       |			libcnotify_print_data(
  566|       |			 &( byte_stream[ byte_stream_offset ] ),
  567|       |			 internal_record->value_data_size,
  568|       |			 LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA );
  569|       |		}
  570|       |#endif
  571|  3.81k|		if( internal_record->value_data_size > MEMORY_MAXIMUM_ALLOCATION_SIZE )
  ------------------
  |  |   46|  3.81k|	( 128 * 1024 * 1024 )
  ------------------
  |  Branch (571:7): [True: 0, False: 3.81k]
  ------------------
  572|      0|		{
  573|      0|			libcerror_error_set(
  574|      0|			 error,
  575|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  576|      0|			 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
  577|      0|			 "%s: invalid value data size value exceeds maximum.",
  578|      0|			 function );
  579|       |
  580|      0|			goto on_error;
  581|      0|		}
  582|  3.81k|		internal_record->value_data = (uint8_t *) memory_allocate(
  ------------------
  |  |   60|  3.81k|	malloc( size )
  ------------------
  583|  3.81k|		                                           sizeof( uint8_t ) * internal_record->value_data_size );
  584|       |
  585|  3.81k|		if( internal_record->value_data == NULL )
  ------------------
  |  Branch (585:7): [True: 0, False: 3.81k]
  ------------------
  586|      0|		{
  587|      0|			libcerror_error_set(
  588|      0|			 error,
  589|      0|			 LIBCERROR_ERROR_DOMAIN_MEMORY,
  590|      0|			 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
  591|      0|			 "%s: unable to create value data.",
  592|      0|			 function );
  593|       |
  594|      0|			goto on_error;
  595|      0|		}
  596|  3.81k|		if( memory_copy(
  ------------------
  |  |  114|  3.81k|	memcpy( (void *) destination, (void *) source, count )
  ------------------
  |  Branch (596:7): [True: 0, False: 3.81k]
  ------------------
  597|  3.81k|		     internal_record->value_data,
  598|  3.81k|		     &( byte_stream[ byte_stream_offset ] ),
  599|  3.81k|		     internal_record->value_data_size ) == NULL )
  600|      0|		{
  601|      0|			libcerror_error_set(
  602|      0|			 error,
  603|      0|			 LIBCERROR_ERROR_DOMAIN_MEMORY,
  604|      0|			 LIBCERROR_MEMORY_ERROR_COPY_FAILED,
  605|      0|			 "%s: unable to copy value data.",
  606|      0|			 function );
  607|       |
  608|      0|			goto on_error;
  609|      0|		}
  610|  3.81k|		byte_stream_offset += internal_record->value_data_size;
  611|  3.81k|	}
  612|       |#if defined( HAVE_DEBUG_OUTPUT )
  613|       |	if( libcnotify_verbose != 0 )
  614|       |	{
  615|       |		if( byte_stream_offset < internal_record->size )
  616|       |		{
  617|       |			libcnotify_printf(
  618|       |			 "%s: trailing data:\n",
  619|       |			 function );
  620|       |			libcnotify_print_data(
  621|       |			 &( byte_stream[ byte_stream_offset ] ),
  622|       |			 internal_record->size - byte_stream_offset,
  623|       |			 LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA );
  624|       |		}
  625|       |	}
  626|       |#endif
  627|  4.66k|	internal_record->ascii_codepage = ascii_codepage;
  628|       |
  629|  4.66k|	return( 1 );
  630|       |
  631|    226|on_error:
  632|       |#if defined( HAVE_DEBUG_OUTPUT )
  633|       |	if( value_string != NULL )
  634|       |	{
  635|       |		memory_free(
  636|       |		 value_string );
  637|       |	}
  638|       |#endif
  639|    226|	if( internal_record->value_data != NULL )
  ------------------
  |  Branch (639:6): [True: 0, False: 226]
  ------------------
  640|      0|	{
  641|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  642|      0|		 internal_record->value_data );
  643|       |
  644|      0|		internal_record->value_data = NULL;
  645|      0|	}
  646|    226|	internal_record->value_data_size = 0;
  647|       |
  648|    226|	return( -1 );
  649|  4.78k|}

libfwps_set_initialize:
   51|   322k|{
   52|   322k|	libfwps_internal_set_t *internal_set = NULL;
   53|   322k|	static char *function                = "libfwps_set_initialize";
   54|       |
   55|   322k|	if( set == NULL )
  ------------------
  |  Branch (55:6): [True: 0, False: 322k]
  ------------------
   56|      0|	{
   57|      0|		libcerror_error_set(
   58|      0|		 error,
   59|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
   60|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
   61|      0|		 "%s: invalid set.",
   62|      0|		 function );
   63|       |
   64|      0|		return( -1 );
   65|      0|	}
   66|   322k|	if( *set != NULL )
  ------------------
  |  Branch (66:6): [True: 0, False: 322k]
  ------------------
   67|      0|	{
   68|      0|		libcerror_error_set(
   69|      0|		 error,
   70|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
   71|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
   72|      0|		 "%s: invalid set value already set.",
   73|      0|		 function );
   74|       |
   75|      0|		return( -1 );
   76|      0|	}
   77|   322k|	internal_set = memory_allocate_structure(
  ------------------
  |  |   64|   322k|	(type *) memory_allocate( sizeof( type ) )
  |  |  ------------------
  |  |  |  |   60|   322k|	malloc( size )
  |  |  ------------------
  ------------------
   78|   322k|	                libfwps_internal_set_t );
   79|       |
   80|   322k|	if( internal_set == NULL )
  ------------------
  |  Branch (80:6): [True: 0, False: 322k]
  ------------------
   81|      0|	{
   82|      0|		libcerror_error_set(
   83|      0|		 error,
   84|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   85|      0|		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
   86|      0|		 "%s: unable to create set.",
   87|      0|		 function );
   88|       |
   89|      0|		goto on_error;
   90|      0|	}
   91|   322k|	if( memory_set(
  ------------------
  |  |  121|   322k|	memset( (void *) buffer, (int) value, count )
  ------------------
  |  Branch (91:6): [True: 0, False: 322k]
  ------------------
   92|   322k|	     internal_set,
   93|   322k|	     0,
   94|   322k|	     sizeof( libfwps_internal_set_t ) ) == NULL )
   95|      0|	{
   96|      0|		libcerror_error_set(
   97|      0|		 error,
   98|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   99|      0|		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
  100|      0|		 "%s: unable to clear set.",
  101|      0|		 function );
  102|       |
  103|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  104|      0|		 internal_set );
  105|       |
  106|      0|		return( -1 );
  107|      0|	}
  108|   322k|	if( libcdata_array_initialize(
  ------------------
  |  Branch (108:6): [True: 0, False: 322k]
  ------------------
  109|   322k|	     &( internal_set->records_array ),
  110|   322k|	     0,
  111|   322k|	     error ) != 1 )
  112|      0|	{
  113|      0|		libcerror_error_set(
  114|      0|		 error,
  115|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  116|      0|		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  117|      0|		 "%s: unable to create records array.",
  118|      0|		 function );
  119|       |
  120|      0|		goto on_error;
  121|      0|	}
  122|   322k|	*set = (libfwps_set_t *) internal_set;
  123|       |
  124|   322k|	return( 1 );
  125|       |
  126|      0|on_error:
  127|      0|	if( internal_set != NULL )
  ------------------
  |  Branch (127:6): [True: 0, False: 0]
  ------------------
  128|      0|	{
  129|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  130|      0|		 internal_set );
  131|      0|	}
  132|      0|	return( -1 );
  133|   322k|}
libfwps_internal_set_free:
  188|   322k|{
  189|   322k|	static char *function = "libfwps_internal_set_free";
  190|   322k|	int result            = 1;
  191|       |
  192|   322k|	if( internal_set == NULL )
  ------------------
  |  Branch (192:6): [True: 0, False: 322k]
  ------------------
  193|      0|	{
  194|      0|		libcerror_error_set(
  195|      0|		 error,
  196|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  197|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  198|      0|		 "%s: invalid set.",
  199|      0|		 function );
  200|       |
  201|      0|		return( -1 );
  202|      0|	}
  203|   322k|	if( *internal_set != NULL )
  ------------------
  |  Branch (203:6): [True: 322k, False: 0]
  ------------------
  204|   322k|	{
  205|   322k|		if( libcdata_array_free(
  ------------------
  |  Branch (205:7): [True: 0, False: 322k]
  ------------------
  206|   322k|		     &( ( *internal_set )->records_array ),
  207|   322k|		     (int(*)(intptr_t **, libcerror_error_t **)) &libfwps_internal_record_free,
  208|   322k|		     error ) != 1 )
  209|      0|		{
  210|      0|			libcerror_error_set(
  211|      0|			 error,
  212|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  213|      0|			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  214|      0|			 "%s: unable to free records array.",
  215|      0|			 function );
  216|       |
  217|      0|			result = -1;
  218|      0|		}
  219|   322k|		memory_free(
  ------------------
  |  |  100|   322k|	free( (void *) buffer )
  ------------------
  220|   322k|		 *internal_set );
  221|       |
  222|   322k|		*internal_set = NULL;
  223|   322k|	}
  224|   322k|	return( result );
  225|   322k|}
libfwps_set_copy_from_byte_stream:
  236|   322k|{
  237|   322k|	libfwps_internal_set_t *internal_set = NULL;
  238|   322k|	libfwps_record_t *property_record    = NULL;
  239|   322k|	static char *function                = "libfwps_set_copy_from_byte_stream";
  240|   322k|	size_t byte_stream_offset            = 0;
  241|   322k|	uint32_t record_data_size            = 0;
  242|   322k|	uint8_t property_record_type         = 0;
  243|   322k|	int entry_index                      = 0;
  244|   322k|	int record_index                     = 0;
  245|       |
  246|       |#if defined( HAVE_DEBUG_OUTPUT )
  247|       |        system_character_t guid_string[ 48 ];
  248|       |
  249|       |        libfguid_identifier_t *guid          = NULL;
  250|       |	int result                           = 0;
  251|       |#endif
  252|       |
  253|   322k|	if( set == NULL )
  ------------------
  |  Branch (253:6): [True: 0, False: 322k]
  ------------------
  254|      0|	{
  255|      0|		libcerror_error_set(
  256|      0|		 error,
  257|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  258|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  259|      0|		 "%s: invalid set.",
  260|      0|		 function );
  261|       |
  262|      0|		return( -1 );
  263|      0|	}
  264|   322k|	internal_set = (libfwps_internal_set_t *) set;
  265|       |
  266|   322k|	if( byte_stream == NULL )
  ------------------
  |  Branch (266:6): [True: 0, False: 322k]
  ------------------
  267|      0|	{
  268|      0|		libcerror_error_set(
  269|      0|		 error,
  270|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  271|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  272|      0|		 "%s: invalid byte stream.",
  273|      0|		 function );
  274|       |
  275|      0|		return( -1 );
  276|      0|	}
  277|   322k|	if( ( byte_stream_size < 24 )
  ------------------
  |  Branch (277:6): [True: 26, False: 322k]
  ------------------
  278|   322k|	 || ( byte_stream_size > (size_t) SSIZE_MAX ) )
  ------------------
  |  Branch (278:6): [True: 0, False: 322k]
  ------------------
  279|     26|	{
  280|     26|		libcerror_error_set(
  281|     26|		 error,
  282|     26|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  283|     26|		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
  284|     26|		 "%s: invalid byte stream size value out of bounds.",
  285|     26|		 function );
  286|       |
  287|     26|		return( -1 );
  288|     26|	}
  289|       |#if defined( HAVE_DEBUG_OUTPUT )
  290|       |	if( libcnotify_verbose != 0 )
  291|       |	{
  292|       |		libcnotify_printf(
  293|       |		 "%s: property set data:\n",
  294|       |		 function );
  295|       |		libcnotify_print_data(
  296|       |		 byte_stream,
  297|       |		 24,
  298|       |		 0 );
  299|       |	}
  300|       |#endif
  301|   322k|	if( memory_compare(
  ------------------
  |  |  107|   322k|	memcmp( (const void *) buffer1, (const void *) buffer2, size )
  ------------------
  |  Branch (301:6): [True: 45, False: 322k]
  ------------------
  302|   322k|	     &( byte_stream[ byte_stream_offset + 4 ] ),
  303|   322k|	     libfwps_serialized_property_set_signature,
  304|   322k|	     4 ) != 0 )
  305|     45|	{
  306|     45|		libcerror_error_set(
  307|     45|		 error,
  308|     45|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  309|     45|		 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
  310|     45|		 "%s: unsupported signature.",
  311|     45|		 function );
  312|       |
  313|     45|		goto on_error;
  314|     45|	}
  315|   322k|	byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|   322k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|   322k|	( value ) <<= 8; \
  |  |   90|   322k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|   322k|	( value ) <<= 8; \
  |  |   92|   322k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|   322k|	( value ) <<= 8; \
  |  |   94|   322k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  316|   322k|	 byte_stream,
  317|   322k|	 internal_set->size );
  318|       |
  319|   322k|	if( memory_copy(
  ------------------
  |  |  114|   322k|	memcpy( (void *) destination, (void *) source, count )
  ------------------
  |  Branch (319:6): [True: 0, False: 322k]
  ------------------
  320|   322k|	     internal_set->identifier,
  321|   322k|	     &( byte_stream[ byte_stream_offset + 8 ] ),
  322|   322k|	     16 ) == NULL )
  323|      0|	{
  324|      0|		libcerror_error_set(
  325|      0|		 error,
  326|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
  327|      0|		 LIBCERROR_MEMORY_ERROR_COPY_FAILED,
  328|      0|		 "%s: unable to copy identifier.",
  329|      0|		 function );
  330|       |
  331|      0|		goto on_error;
  332|      0|	}
  333|       |#if defined( HAVE_DEBUG_OUTPUT )
  334|       |	if( libcnotify_verbose != 0 )
  335|       |	{
  336|       |		libcnotify_printf(
  337|       |		 "%s: size\t\t\t\t\t: %" PRIu16 "\n",
  338|       |		 function,
  339|       |		 internal_set->size );
  340|       |
  341|       |		libcnotify_printf(
  342|       |		 "%s: signature\t\t\t\t: %c%c%c%c\n",
  343|       |		 function,
  344|       |		 byte_stream[ byte_stream_offset + 4 ],
  345|       |		 byte_stream[ byte_stream_offset + 5 ],
  346|       |		 byte_stream[ byte_stream_offset + 6 ],
  347|       |		 byte_stream[ byte_stream_offset + 7 ] );
  348|       |
  349|       |		if( libfguid_identifier_initialize(
  350|       |		     &guid,
  351|       |		     error ) != 1 )
  352|       |		{
  353|       |			libcerror_error_set(
  354|       |			 error,
  355|       |			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  356|       |			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  357|       |			 "%s: unable to create GUID.",
  358|       |			 function );
  359|       |
  360|       |			goto on_error;
  361|       |		}
  362|       |		if( libfguid_identifier_copy_from_byte_stream(
  363|       |		     guid,
  364|       |		     internal_set->identifier,
  365|       |		     16,
  366|       |		     LIBFGUID_ENDIAN_LITTLE,
  367|       |		     error ) != 1 )
  368|       |		{
  369|       |			libcerror_error_set(
  370|       |			 error,
  371|       |			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  372|       |			 LIBCERROR_RUNTIME_ERROR_COPY_FAILED,
  373|       |			 "%s: unable to copy byte stream to GUID.",
  374|       |			 function );
  375|       |
  376|       |			goto on_error;
  377|       |		}
  378|       |#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
  379|       |		result = libfguid_identifier_copy_to_utf16_string(
  380|       |			  guid,
  381|       |			  (uint16_t *) guid_string,
  382|       |			  48,
  383|       |			  LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES,
  384|       |			  error );
  385|       |#else
  386|       |		result = libfguid_identifier_copy_to_utf8_string(
  387|       |			  guid,
  388|       |			  (uint8_t *) guid_string,
  389|       |			  48,
  390|       |			  LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES,
  391|       |			  error );
  392|       |#endif
  393|       |		if( result != 1 )
  394|       |		{
  395|       |			libcerror_error_set(
  396|       |			 error,
  397|       |			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  398|       |			 LIBCERROR_RUNTIME_ERROR_COPY_FAILED,
  399|       |			 "%s: unable to copy GUID to string.",
  400|       |			 function );
  401|       |
  402|       |			goto on_error;
  403|       |		}
  404|       |		libcnotify_printf(
  405|       |		 "%s: format class identifier\t\t: %" PRIs_SYSTEM "\n",
  406|       |		 function,
  407|       |		 guid_string );
  408|       |
  409|       |		if( libfguid_identifier_free(
  410|       |		     &guid,
  411|       |		     error ) != 1 )
  412|       |		{
  413|       |			libcerror_error_set(
  414|       |			 error,
  415|       |			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  416|       |			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  417|       |			 "%s: unable to free GUID.",
  418|       |			 function );
  419|       |
  420|       |			goto on_error;
  421|       |		}
  422|       |	}
  423|       |#endif /* defined( HAVE_DEBUG_OUTPUT ) */
  424|       |
  425|   322k|	if( ( internal_set->size < 24 )
  ------------------
  |  Branch (425:6): [True: 0, False: 322k]
  ------------------
  426|   322k|	 || ( (size_t) internal_set->size > byte_stream_size ) )
  ------------------
  |  Branch (426:6): [True: 0, False: 322k]
  ------------------
  427|      0|	{
  428|      0|		libcerror_error_set(
  429|      0|		 error,
  430|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  431|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  432|      0|		 "%s: invalid property set size value out of bounds.",
  433|      0|		 function );
  434|       |
  435|      0|		goto on_error;
  436|      0|	}
  437|   322k|	byte_stream_offset += 24;
  438|       |
  439|   322k|	if( memory_compare(
  ------------------
  |  |  107|   322k|	memcmp( (const void *) buffer1, (const void *) buffer2, size )
  ------------------
  |  Branch (439:6): [True: 625, False: 321k]
  ------------------
  440|   322k|	     internal_set->identifier,
  441|   322k|	     libfwps_format_class_identifier_named_properties,
  442|   322k|	     16 ) == 0 )
  443|    625|	{
  444|    625|		property_record_type = LIBFWPS_RECORD_TYPE_NAMED;
  445|    625|	}
  446|   321k|	else
  447|   321k|	{
  448|   321k|		property_record_type = LIBFWPS_RECORD_TYPE_NUMERIC;
  449|   321k|	}
  450|   326k|	while( byte_stream_offset < byte_stream_size )
  ------------------
  |  Branch (450:9): [True: 28.1k, False: 298k]
  ------------------
  451|  28.1k|	{
  452|  28.1k|		if( byte_stream_offset > ( byte_stream_size - 4 ) )
  ------------------
  |  Branch (452:7): [True: 27, False: 28.1k]
  ------------------
  453|     27|		{
  454|     27|			libcerror_error_set(
  455|     27|			 error,
  456|     27|			 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  457|     27|			 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
  458|     27|			 "%s: invalid byte stream size value too small.",
  459|     27|			 function );
  460|       |
  461|     27|			goto on_error;
  462|     27|		}
  463|  28.1k|		byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|  28.1k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|  28.1k|	( value ) <<= 8; \
  |  |   90|  28.1k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|  28.1k|	( value ) <<= 8; \
  |  |   92|  28.1k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|  28.1k|	( value ) <<= 8; \
  |  |   94|  28.1k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  464|  28.1k|		 &( byte_stream[ byte_stream_offset ] ),
  465|  28.1k|		 record_data_size );
  466|       |
  467|       |#if defined( HAVE_DEBUG_OUTPUT )
  468|       |		if( libcnotify_verbose != 0 )
  469|       |		{
  470|       |			libcnotify_printf(
  471|       |			 "%s: record: %d data size\t\t\t: %" PRIu32 "\n",
  472|       |			 function,
  473|       |			 record_index,
  474|       |			 record_data_size );
  475|       |		}
  476|       |#endif
  477|  28.1k|		if( record_data_size == 0 )
  ------------------
  |  Branch (477:7): [True: 23.0k, False: 5.05k]
  ------------------
  478|  23.0k|		{
  479|  23.0k|			break;
  480|  23.0k|		}
  481|  5.05k|		if( ( record_data_size > byte_stream_size )
  ------------------
  |  Branch (481:7): [True: 106, False: 4.94k]
  ------------------
  482|  5.05k|		 || ( byte_stream_offset > ( byte_stream_size - record_data_size ) ) )
  ------------------
  |  Branch (482:7): [True: 25, False: 4.92k]
  ------------------
  483|    131|		{
  484|    131|			libcerror_error_set(
  485|    131|			 error,
  486|    131|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  487|    131|			 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  488|    131|			 "%s: invalid record: %d data size value out of bounds.",
  489|    131|			 function,
  490|    131|			 record_index );
  491|       |
  492|    131|			goto on_error;
  493|    131|		}
  494|  4.92k|		if( libfwps_record_initialize(
  ------------------
  |  Branch (494:7): [True: 0, False: 4.92k]
  ------------------
  495|  4.92k|		     &property_record,
  496|  4.92k|		     property_record_type,
  497|  4.92k|		     error ) != 1 )
  498|      0|		{
  499|      0|			libcerror_error_set(
  500|      0|			 error,
  501|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  502|      0|			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  503|      0|			 "%s: unable to create property record: %d.",
  504|      0|			 function,
  505|      0|			 record_index );
  506|       |
  507|      0|			goto on_error;
  508|      0|		}
  509|  4.92k|		if( libfwps_record_copy_from_byte_stream(
  ------------------
  |  Branch (509:7): [True: 255, False: 4.66k]
  ------------------
  510|  4.92k|		     property_record,
  511|  4.92k|		     &( byte_stream[ byte_stream_offset ] ),
  512|  4.92k|		     record_data_size,
  513|  4.92k|		     ascii_codepage,
  514|  4.92k|		     error ) != 1 )
  515|    255|		{
  516|    255|			libcerror_error_set(
  517|    255|			 error,
  518|    255|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  519|    255|			 LIBCERROR_RUNTIME_ERROR_COPY_FAILED,
  520|    255|			 "%s: unable to copy property record: %d from byte stream.",
  521|    255|			 function,
  522|    255|			 record_index );
  523|       |
  524|    255|			goto on_error;
  525|    255|		}
  526|  4.66k|		if( libcdata_array_append_entry(
  ------------------
  |  Branch (526:7): [True: 0, False: 4.66k]
  ------------------
  527|  4.66k|		     internal_set->records_array,
  528|  4.66k|		     &entry_index,
  529|  4.66k|		     (intptr_t *) property_record,
  530|  4.66k|		     error ) != 1 )
  531|      0|		{
  532|      0|			libcerror_error_set(
  533|      0|			 error,
  534|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  535|      0|			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  536|      0|			 "%s: unable to append record: %d to array.",
  537|      0|			 function,
  538|      0|			 record_index );
  539|       |
  540|      0|			goto on_error;
  541|      0|		}
  542|  4.66k|		property_record = NULL;
  543|       |
  544|  4.66k|		byte_stream_offset += record_data_size;
  545|       |
  546|  4.66k|		record_index++;
  547|  4.66k|	}
  548|       |/* TODO print trailing data */
  549|       |
  550|       |#if defined( HAVE_DEBUG_OUTPUT )
  551|       |	if( libcnotify_verbose != 0 )
  552|       |	{
  553|       |		libcnotify_printf(
  554|       |		 "\n" );
  555|       |	}
  556|       |#endif
  557|   321k|	return( 1 );
  558|       |
  559|    458|on_error:
  560|       |#if defined( HAVE_DEBUG_OUTPUT )
  561|       |	if( guid != NULL )
  562|       |	{
  563|       |		libfguid_identifier_free(
  564|       |		 &guid,
  565|       |		 NULL );
  566|       |	}
  567|       |#endif
  568|    458|	if( property_record != NULL )
  ------------------
  |  Branch (568:6): [True: 255, False: 203]
  ------------------
  569|    255|	{
  570|    255|		libfwps_internal_record_free(
  571|    255|		 (libfwps_internal_record_t **) &property_record,
  572|    255|		 NULL );
  573|    255|	}
  574|    458|	return( -1 );
  575|   322k|}

libfwps_store_initialize:
   41|    946|{
   42|    946|	libfwps_internal_store_t *internal_store = NULL;
   43|    946|	static char *function                    = "libfwps_store_initialize";
   44|       |
   45|    946|	if( store == NULL )
  ------------------
  |  Branch (45:6): [True: 0, False: 946]
  ------------------
   46|      0|	{
   47|      0|		libcerror_error_set(
   48|      0|		 error,
   49|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
   50|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
   51|      0|		 "%s: invalid store.",
   52|      0|		 function );
   53|       |
   54|      0|		return( -1 );
   55|      0|	}
   56|    946|	if( *store != NULL )
  ------------------
  |  Branch (56:6): [True: 0, False: 946]
  ------------------
   57|      0|	{
   58|      0|		libcerror_error_set(
   59|      0|		 error,
   60|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
   61|      0|		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
   62|      0|		 "%s: invalid store value already set.",
   63|      0|		 function );
   64|       |
   65|      0|		return( -1 );
   66|      0|	}
   67|    946|	internal_store = memory_allocate_structure(
  ------------------
  |  |   64|    946|	(type *) memory_allocate( sizeof( type ) )
  |  |  ------------------
  |  |  |  |   60|    946|	malloc( size )
  |  |  ------------------
  ------------------
   68|    946|	                  libfwps_internal_store_t );
   69|       |
   70|    946|	if( internal_store == NULL )
  ------------------
  |  Branch (70:6): [True: 0, False: 946]
  ------------------
   71|      0|	{
   72|      0|		libcerror_error_set(
   73|      0|		 error,
   74|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   75|      0|		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
   76|      0|		 "%s: unable to create store.",
   77|      0|		 function );
   78|       |
   79|      0|		goto on_error;
   80|      0|	}
   81|    946|	if( memory_set(
  ------------------
  |  |  121|    946|	memset( (void *) buffer, (int) value, count )
  ------------------
  |  Branch (81:6): [True: 0, False: 946]
  ------------------
   82|    946|	     internal_store,
   83|    946|	     0,
   84|    946|	     sizeof( libfwps_internal_store_t ) ) == NULL )
   85|      0|	{
   86|      0|		libcerror_error_set(
   87|      0|		 error,
   88|      0|		 LIBCERROR_ERROR_DOMAIN_MEMORY,
   89|      0|		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
   90|      0|		 "%s: unable to clear store.",
   91|      0|		 function );
   92|       |
   93|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
   94|      0|		 internal_store );
   95|       |
   96|      0|		return( -1 );
   97|      0|	}
   98|    946|	if( libcdata_array_initialize(
  ------------------
  |  Branch (98:6): [True: 0, False: 946]
  ------------------
   99|    946|	     &( internal_store->sets_array ),
  100|    946|	     0,
  101|    946|	     error ) != 1 )
  102|      0|	{
  103|      0|		libcerror_error_set(
  104|      0|		 error,
  105|      0|		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  106|      0|		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  107|      0|		 "%s: unable to create sets array.",
  108|      0|		 function );
  109|       |
  110|      0|		goto on_error;
  111|      0|	}
  112|    946|	*store = (libfwps_store_t *) internal_store;
  113|       |
  114|    946|	return( 1 );
  115|       |
  116|      0|on_error:
  117|      0|	if( internal_store != NULL )
  ------------------
  |  Branch (117:6): [True: 0, False: 0]
  ------------------
  118|      0|	{
  119|      0|		memory_free(
  ------------------
  |  |  100|      0|	free( (void *) buffer )
  ------------------
  120|      0|		 internal_store );
  121|      0|	}
  122|      0|	return( -1 );
  123|    946|}
libfwps_store_free:
  131|    946|{
  132|    946|	libfwps_internal_store_t *internal_store = NULL;
  133|    946|	static char *function                    = "libfwps_store_free";
  134|    946|	int result                               = 1;
  135|       |
  136|    946|	if( store == NULL )
  ------------------
  |  Branch (136:6): [True: 0, False: 946]
  ------------------
  137|      0|	{
  138|      0|		libcerror_error_set(
  139|      0|		 error,
  140|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  141|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  142|      0|		 "%s: invalid store.",
  143|      0|		 function );
  144|       |
  145|      0|		return( -1 );
  146|      0|	}
  147|    946|	if( *store != NULL )
  ------------------
  |  Branch (147:6): [True: 946, False: 0]
  ------------------
  148|    946|	{
  149|    946|		internal_store = (libfwps_internal_store_t *) *store;
  150|    946|		*store         = NULL;
  151|       |
  152|    946|		if( libcdata_array_free(
  ------------------
  |  Branch (152:7): [True: 0, False: 946]
  ------------------
  153|    946|		     &( internal_store->sets_array ),
  154|    946|		     (int(*)(intptr_t **, libcerror_error_t **)) &libfwps_internal_set_free,
  155|    946|		     error ) != 1 )
  156|      0|		{
  157|      0|			libcerror_error_set(
  158|      0|			 error,
  159|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  160|      0|			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
  161|      0|			 "%s: unable to free sets array.",
  162|      0|			 function );
  163|       |
  164|      0|			result = -1;
  165|      0|		}
  166|    946|		memory_free(
  ------------------
  |  |  100|    946|	free( (void *) buffer )
  ------------------
  167|    946|		 internal_store );
  168|    946|	}
  169|    946|	return( result );
  170|    946|}
libfwps_store_copy_from_byte_stream:
  181|    946|{
  182|    946|	libfwps_internal_store_t *internal_store = NULL;
  183|    946|	libfwps_set_t *set                       = NULL;
  184|    946|	static char *function                    = "libfwps_store_copy_from_byte_stream";
  185|    946|	size_t byte_stream_offset                = 0;
  186|    946|	uint32_t set_data_size                   = 0;
  187|    946|	int entry_index                          = 0;
  188|    946|	int set_index                            = 0;
  189|       |
  190|    946|	if( store == NULL )
  ------------------
  |  Branch (190:6): [True: 0, False: 946]
  ------------------
  191|      0|	{
  192|      0|		libcerror_error_set(
  193|      0|		 error,
  194|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  195|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  196|      0|		 "%s: invalid store.",
  197|      0|		 function );
  198|       |
  199|      0|		return( -1 );
  200|      0|	}
  201|    946|	internal_store = (libfwps_internal_store_t *) store;
  202|       |
  203|    946|	if( byte_stream == NULL )
  ------------------
  |  Branch (203:6): [True: 0, False: 946]
  ------------------
  204|      0|	{
  205|      0|		libcerror_error_set(
  206|      0|		 error,
  207|      0|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  208|      0|		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
  209|      0|		 "%s: invalid byte stream.",
  210|      0|		 function );
  211|       |
  212|      0|		return( -1 );
  213|      0|	}
  214|    946|	if( ( byte_stream_size < 4 )
  ------------------
  |  Branch (214:6): [True: 2, False: 944]
  ------------------
  215|    946|	 || ( byte_stream_size > (size_t) SSIZE_MAX ) )
  ------------------
  |  Branch (215:6): [True: 0, False: 944]
  ------------------
  216|      2|	{
  217|      2|		libcerror_error_set(
  218|      2|		 error,
  219|      2|		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  220|      2|		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
  221|      2|		 "%s: invalid byte stream size value out of bounds.",
  222|      2|		 function );
  223|       |
  224|      2|		return( -1 );
  225|      2|	}
  226|   322k|	while( byte_stream_offset < byte_stream_size )
  ------------------
  |  Branch (226:9): [True: 322k, False: 265]
  ------------------
  227|   322k|	{
  228|   322k|		if( byte_stream_offset > ( byte_stream_size - 4 ) )
  ------------------
  |  Branch (228:7): [True: 34, False: 322k]
  ------------------
  229|     34|		{
  230|     34|			libcerror_error_set(
  231|     34|			 error,
  232|     34|			 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
  233|     34|			 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
  234|     34|			 "%s: invalid byte stream size value too small.",
  235|     34|			 function );
  236|       |
  237|     34|			goto on_error;
  238|     34|		}
  239|   322k|		byte_stream_copy_to_uint32_little_endian(
  ------------------
  |  |   88|   322k|	( value )   = ( byte_stream )[ 3 ]; \
  |  |   89|   322k|	( value ) <<= 8; \
  |  |   90|   322k|	( value )  |= ( byte_stream )[ 2 ]; \
  |  |   91|   322k|	( value ) <<= 8; \
  |  |   92|   322k|	( value )  |= ( byte_stream )[ 1 ]; \
  |  |   93|   322k|	( value ) <<= 8; \
  |  |   94|   322k|	( value )  |= ( byte_stream )[ 0 ];
  ------------------
  240|   322k|		 &( byte_stream[ byte_stream_offset ] ),
  241|   322k|		 set_data_size );
  242|       |
  243|       |#if defined( HAVE_DEBUG_OUTPUT )
  244|       |		if( libcnotify_verbose != 0 )
  245|       |		{
  246|       |			libcnotify_printf(
  247|       |			 "%s: set: %d data size\t\t\t: %" PRIu32 "\n",
  248|       |			 function,
  249|       |			 set_index,
  250|       |			 set_data_size );
  251|       |		}
  252|       |#endif
  253|   322k|		if( set_data_size == 0 )
  ------------------
  |  Branch (253:7): [True: 11, False: 322k]
  ------------------
  254|     11|		{
  255|     11|			break;
  256|     11|		}
  257|   322k|		if( ( set_data_size > byte_stream_size )
  ------------------
  |  Branch (257:7): [True: 116, False: 322k]
  ------------------
  258|   322k|		 || ( byte_stream_offset > ( byte_stream_size - set_data_size ) ) )
  ------------------
  |  Branch (258:7): [True: 34, False: 322k]
  ------------------
  259|    150|		{
  260|    150|			libcerror_error_set(
  261|    150|			 error,
  262|    150|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  263|    150|			 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
  264|    150|			 "%s: invalid set: %d data size value out of bounds.",
  265|    150|			 function,
  266|    150|			 set_index );
  267|       |
  268|    150|			goto on_error;
  269|    150|		}
  270|   322k|		if( libfwps_set_initialize(
  ------------------
  |  Branch (270:7): [True: 0, False: 322k]
  ------------------
  271|   322k|		     &set,
  272|   322k|		     error ) != 1 )
  273|      0|		{
  274|      0|			libcerror_error_set(
  275|      0|			 error,
  276|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  277|      0|			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  278|      0|			 "%s: unable to create set: %d.",
  279|      0|			 function,
  280|      0|			 set_index );
  281|       |
  282|      0|			goto on_error;
  283|      0|		}
  284|   322k|		( (libfwps_internal_set_t *) set )->is_managed = 1;
  285|       |
  286|   322k|		if( libfwps_set_copy_from_byte_stream(
  ------------------
  |  Branch (286:7): [True: 484, False: 321k]
  ------------------
  287|   322k|		     set,
  288|   322k|		     &( byte_stream[ byte_stream_offset ] ),
  289|   322k|		     (size_t) set_data_size,
  290|   322k|		     ascii_codepage,
  291|   322k|		     error ) != 1 )
  292|    484|		{
  293|    484|			libcerror_error_set(
  294|    484|			 error,
  295|    484|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  296|    484|			 LIBCERROR_RUNTIME_ERROR_COPY_FAILED,
  297|    484|			 "%s: unable to copy set: %d from byte stream.",
  298|    484|			 function,
  299|    484|			 set_index );
  300|       |
  301|    484|			goto on_error;
  302|    484|		}
  303|   321k|		if( libcdata_array_append_entry(
  ------------------
  |  Branch (303:7): [True: 0, False: 321k]
  ------------------
  304|   321k|		     internal_store->sets_array,
  305|   321k|		     &entry_index,
  306|   321k|		     (intptr_t *) set,
  307|   321k|		     error ) != 1 )
  308|      0|		{
  309|      0|			libcerror_error_set(
  310|      0|			 error,
  311|      0|			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
  312|      0|			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
  313|      0|			 "%s: unable to append set: %d to array.",
  314|      0|			 function,
  315|      0|			 set_index );
  316|       |
  317|      0|			goto on_error;
  318|      0|		}
  319|   321k|		set = NULL;
  320|       |
  321|   321k|		byte_stream_offset += set_data_size;
  322|       |
  323|   321k|		set_index++;
  324|   321k|	}
  325|    276|	return( 1 );
  326|       |
  327|    668|on_error:
  328|    668|	if( set != NULL )
  ------------------
  |  Branch (328:6): [True: 484, False: 184]
  ------------------
  329|    484|	{
  330|    484|		libfwps_internal_set_free(
  331|    484|		 (libfwps_internal_set_t **) &set,
  332|    484|		 NULL );
  333|    484|	}
  334|    668|	libcdata_array_empty(
  335|    668|	 internal_store->sets_array,
  336|    668|	 (int(*)(intptr_t **, libcerror_error_t **)) &libfwps_internal_set_free,
  337|    668|	 NULL );
  338|       |
  339|    668|	return( -1 );
  340|    944|}

LLVMFuzzerTestOneInput:
   34|    946|{
   35|    946|	libfwps_store_t *store = NULL;
   36|       |
   37|    946|	if( libfwps_store_initialize(
  ------------------
  |  Branch (37:6): [True: 0, False: 946]
  ------------------
   38|    946|	     &store,
   39|    946|	     NULL ) != 1 )
   40|      0|	{
   41|      0|		return( 0 );
   42|      0|	}
   43|    946|	libfwps_store_copy_from_byte_stream(
   44|    946|	 store,
   45|    946|	 data,
   46|    946|	 size,
   47|    946|	 LIBFWPS_CODEPAGE_WINDOWS_1252,
   48|    946|	 NULL );
   49|       |
   50|    946|	libfwps_store_free(
   51|    946|	 &store,
   52|    946|	 NULL );
   53|       |
   54|    946|	return( 0 );
   55|    946|}

