Coverage Report

Created: 2026-04-01 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pidgin/libpurple/pidgin_utils_fuzzer.c
Line
Count
Source
1
/*
2
# Copyright 2021 Google LLC
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#      http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#
16
################################################################################
17
*/
18
19
#include <stdint.h>
20
#include <stdlib.h>
21
#include <string.h>
22
23
#include "util.h"
24
25
1.51k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
26
1.51k
  char *nstr = (char *)malloc(size + 1);
27
1.51k
  if (nstr == NULL) {
28
0
    return 0;
29
0
  }
30
1.51k
  memcpy(nstr, data, size);
31
1.51k
  nstr[size] = '\0';
32
33
1.51k
  guchar *tmp = NULL;
34
1.51k
  gsize retlen;
35
36
1.51k
  if (size % 2 == 0 && strlen(nstr) > 0) {
37
797
    tmp = purple_base16_decode(nstr, &retlen);
38
797
    if (tmp != NULL) {
39
732
      g_free(tmp);
40
732
    }
41
797
  }
42
43
1.51k
  tmp = NULL;
44
1.51k
  tmp = purple_quotedp_decode(nstr, &retlen);
45
1.51k
  if (tmp != NULL) {
46
1.51k
    g_free(tmp);
47
1.51k
  }
48
49
1.51k
  char *tmp2 = NULL;
50
1.51k
  tmp2 = purple_mime_decode_field(nstr);
51
1.51k
  if (tmp2 != NULL) {
52
1.51k
    free(tmp2);
53
1.51k
  }
54
55
1.51k
  purple_str_to_time(nstr, TRUE, NULL, NULL, NULL);
56
57
1.51k
  gchar *xhtml = NULL;
58
1.51k
  gchar *plaintext = NULL;
59
1.51k
  purple_markup_html_to_xhtml(nstr, &xhtml, &plaintext);
60
61
1.51k
  if (xhtml != NULL) {
62
1.51k
    g_free(xhtml);
63
1.51k
  }
64
65
1.51k
  if (plaintext != NULL) {
66
1.51k
    g_free(plaintext);
67
1.51k
  }
68
69
1.51k
  char *tmp3 = purple_markup_strip_html(nstr);
70
1.51k
  if (tmp3 != NULL) {
71
1.51k
    free(tmp3);
72
1.51k
  }
73
74
1.51k
  purple_markup_is_rtl(nstr);
75
76
1.51k
  free(nstr);
77
1.51k
  return 0;
78
1.51k
}