This file is indexed.

/usr/share/slsh/local-packages/xfig/png.sl is in slang-xfig 0.2.0~.35-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
private variable Magic_Bytes = "\d137\d80\d78\d71\d13\d10\d26\d10";

private define read_exactly_n_bytes (fd, n)
{
   variable buf;
   variable nbytes = read (fd, &buf, n);
   if (nbytes != n)
     verror ("Error reading png file");
   return buf;
}

private define open_png (png)
{
   variable fd = open (png, O_RDONLY);
   if (fd == NULL)
     verror ("Unable to open png file %S", png);
   variable magic = read_exactly_n_bytes (fd, strlen (Magic_Bytes));
   if (magic != Magic_Bytes)
     verror ("%s is not a PNG file", png);
   
   return fd;
}

private define read_4byte_uint (fd)
{
   variable buf = read_exactly_n_bytes (fd, 4);
   return unpack (">K", buf);
}

private define read_png_chunk (fd)
{
   variable length, type, data, crc;

   length = read_4byte_uint (fd);
   type = read_exactly_n_bytes (fd, 4);
   %type = read_4byte_uint (fd);
   data = read_exactly_n_bytes (fd, length);
   crc = read_4byte_uint (fd);
   
   return length, type, data, crc;
}

% The IHDR chunk must appear FIRST. It contains:
% Width:              4 bytes
% Height:             4 bytes
% Bit depth:          1 byte
% Color type:         1 byte
% Compression method: 1 byte
% Filter method:      1 byte
% Interlace method:   1 byte

define xfig_new_png (file)
{
   variable fd = open_png (file);
   variable length, type, data, crc;
   (length, type, data, crc) = read_png_chunk (fd);
   if (type != "IHDR")
     verror ("Expecting an IHDR header in %s", file);
   variable width, height;
   
   (width, height) = unpack (">k>k", data);
   
   () = close (fd);

   width *= xfig_get_display_pix_size ();
   height *= xfig_get_display_pix_size ();
   
   return xfig_new_pict (file, width, height);
}