libavformat/spdifdec.c:60: error: Null Dereference
  pointer `&gbc->buffer` last assigned on line 59 could be null and is dereferenced by call to `avpriv_aac_parse_header()` at line 60, column 13.

libavformat/spdifdec.c:33:1: start of procedure spdif_get_offset_and_codec()
31. #include "libavcodec/aacadtsdec.h"
32. 
33. static int spdif_get_offset_and_codec(AVFormatContext *s,
    ^
34.                                       enum IEC61937DataType data_type,
35.                                       const char *buf, int *offset,

libavformat/spdifdec.c:41:5: 
39.     GetBitContext gbc;
40. 
41.     switch (data_type & 0xff) {
        ^
42.     case IEC61937_AC3:
43.         *offset = AC3_FRAME_SIZE << 2;

libavformat/spdifdec.c:42:5: Switch condition is false. Skipping switch case
40. 
41.     switch (data_type & 0xff) {
42.     case IEC61937_AC3:
        ^
43.         *offset = AC3_FRAME_SIZE << 2;
44.         *codec = CODEC_ID_AC3;

libavformat/spdifdec.c:46:5: Switch condition is false. Skipping switch case
44.         *codec = CODEC_ID_AC3;
45.         break;
46.     case IEC61937_MPEG1_LAYER1:
        ^
47.         *offset = spdif_mpeg_pkt_offset[1][0];
48.         *codec = CODEC_ID_MP1;

libavformat/spdifdec.c:50:5: Switch condition is false. Skipping switch case
48.         *codec = CODEC_ID_MP1;
49.         break;
50.     case IEC61937_MPEG1_LAYER23:
        ^
51.         *offset = spdif_mpeg_pkt_offset[1][0];
52.         *codec = CODEC_ID_MP3;

libavformat/spdifdec.c:54:5: Switch condition is false. Skipping switch case
52.         *codec = CODEC_ID_MP3;
53.         break;
54.     case IEC61937_MPEG2_EXT:
        ^
55.         *offset = 4608;
56.         *codec = CODEC_ID_MP3;

libavformat/spdifdec.c:58:5: Switch condition is true. Entering switch case
56.         *codec = CODEC_ID_MP3;
57.         break;
58.     case IEC61937_MPEG2_AAC:
        ^
59.         init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
60.         if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {

libavformat/spdifdec.c:59:9: 
57.         break;
58.     case IEC61937_MPEG2_AAC:
59.         init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
            ^
60.         if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {
61.             if (s) /* be silent during a probe */

libavcodec/get_bits.h:306:1: start of procedure init_get_bits()
  304.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  305.  */
  306. static inline void init_get_bits(GetBitContext *s,
       ^
  307.                    const uint8_t *buffer, int bit_size)
  308. {

libavcodec/get_bits.h:309:5: 
  307.                    const uint8_t *buffer, int bit_size)
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
           ^
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:310:9: Taking true branch
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
               ^
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;

libavcodec/get_bits.h:311:9: 
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;
               ^
  312.         buffer = NULL;
  313.     }

libavcodec/get_bits.h:312:9: 
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;
               ^
  313.     }
  314. 

libavcodec/get_bits.h:315:5: 
  313.     }
  314. 
  315.     s->buffer       = buffer;
           ^
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;

libavcodec/get_bits.h:316:5: 
  314. 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
           ^
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;

libavcodec/get_bits.h:317:5: 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
           ^
  318.     s->index        = 0;
  319. }

libavcodec/get_bits.h:318:5: 
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
           ^
  319. }
  320. 

libavcodec/get_bits.h:319:1: return from a call to init_get_bits
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
  319. }
       ^
  320. 
  321. static inline void align_get_bits(GetBitContext *s)

libavformat/spdifdec.c:60:13: 
58.     case IEC61937_MPEG2_AAC:
59.         init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
60.         if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {
                ^
61.             if (s) /* be silent during a probe */
62.                 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");

libavcodec/aacadtsdec.c:29:1: start of procedure avpriv_aac_parse_header()
  27. #include "mpeg4audio.h"
  28. 
  29. int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
      ^
  30. {
  31.     int size, rdb, ch, sr;

libavcodec/aacadtsdec.c:34:8: 
  32.     int aot, crc_abs;
  33. 
  34.     if(get_bits(gbc, 12) != 0xfff)
             ^
  35.         return AAC_AC3_PARSE_ERROR_SYNC;
  36. 

libavcodec/get_bits.h:201:1: start of procedure get_bits()
    199.  * Read 1-25 bits.
    200.  */
    201. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    202.     register int tmp;
    203.     OPEN_READER(re, s);

libavcodec/get_bits.h:203:5: 
    201. static inline unsigned int get_bits(GetBitContext *s, int n){
    202.     register int tmp;
    203.     OPEN_READER(re, s);
             ^
    204.     UPDATE_CACHE(re, s);
    205.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:204:5: 
    202.     register int tmp;
    203.     OPEN_READER(re, s);
    204.     UPDATE_CACHE(re, s);
             ^
    205.     tmp = SHOW_UBITS(re, s, n);
    206.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
      64. 
      65. #ifndef av_bswap32
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
          ^
      67. {
      68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      67. {
      68.     return AV_BSWAP32C(x);
              ^
      69. }
      70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
      67. {
      68.     return AV_BSWAP32C(x);
      69. }
          ^
      70. #endif
      71. 

libavcodec/get_bits.h:205:5: 
    203.     OPEN_READER(re, s);
    204.     UPDATE_CACHE(re, s);
    205.     tmp = SHOW_UBITS(re, s, n);
             ^
    206.     LAST_SKIP_BITS(re, s, n);
    207.     CLOSE_READER(re, s);

libavcodec/get_bits.h:206:5: 
    204.     UPDATE_CACHE(re, s);
    205.     tmp = SHOW_UBITS(re, s, n);
    206.     LAST_SKIP_BITS(re, s, n);
             ^
    207.     CLOSE_READER(re, s);
    208.     return tmp;

libavcodec/get_bits.h:207:5: 
    205.     tmp = SHOW_UBITS(re, s, n);
    206.     LAST_SKIP_BITS(re, s, n);
    207.     CLOSE_READER(re, s);
             ^
    208.     return tmp;
    209. }

libavcodec/get_bits.h:208:5: 
    206.     LAST_SKIP_BITS(re, s, n);
    207.     CLOSE_READER(re, s);
    208.     return tmp;
             ^
    209. }
    210. 

libavcodec/get_bits.h:209:1: return from a call to get_bits
    207.     CLOSE_READER(re, s);
    208.     return tmp;
    209. }
         ^
    210. 
    211. /**

libavcodec/aacadtsdec.c:34:8: Taking false branch
  32.     int aot, crc_abs;
  33. 
  34.     if(get_bits(gbc, 12) != 0xfff)
             ^
  35.         return AAC_AC3_PARSE_ERROR_SYNC;
  36. 

libavcodec/aacadtsdec.c:37:5: 
  35.         return AAC_AC3_PARSE_ERROR_SYNC;
  36. 
  37.     skip_bits1(gbc);             /* id */
          ^
  38.     skip_bits(gbc, 2);           /* layer */
  39.     crc_abs = get_bits1(gbc);    /* protection_absent */

libavcodec/get_bits.h:250:1: start of procedure skip_bits1()
    248. }
    249. 
    250. static inline void skip_bits1(GetBitContext *s){
         ^
    251.     skip_bits(s, 1);
    252. }

libavcodec/get_bits.h:251:5: 
    249. 
    250. static inline void skip_bits1(GetBitContext *s){
    251.     skip_bits(s, 1);
             ^
    252. }
    253. 

libavcodec/get_bits.h:222:1: start of procedure skip_bits()
      220. }
      221. 
      222. static inline void skip_bits(GetBitContext *s, int n){
           ^
      223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
      224.     OPEN_READER(re, s);

libavcodec/get_bits.h:224:5: 
      222. static inline void skip_bits(GetBitContext *s, int n){
      223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
      224.     OPEN_READER(re, s);
               ^
      225.     UPDATE_CACHE(re, s);
      226.     LAST_SKIP_BITS(re, s, n);

libavcodec/get_bits.h:225:5: 
      223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
      224.     OPEN_READER(re, s);
      225.     UPDATE_CACHE(re, s);
               ^
      226.     LAST_SKIP_BITS(re, s, n);
      227.     CLOSE_READER(re, s);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
        64. 
        65. #ifndef av_bswap32
        66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
            ^
        67. {
        68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
        66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        67. {
        68.     return AV_BSWAP32C(x);
                ^
        69. }
        70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
        67. {
        68.     return AV_BSWAP32C(x);
        69. }
            ^
        70. #endif
        71. 

libavcodec/get_bits.h:226:5: 
      224.     OPEN_READER(re, s);
      225.     UPDATE_CACHE(re, s);
      226.     LAST_SKIP_BITS(re, s, n);
               ^
      227.     CLOSE_READER(re, s);
      228. }

libavcodec/get_bits.h:227:5: 
      225.     UPDATE_CACHE(re, s);
      226.     LAST_SKIP_BITS(re, s, n);
      227.     CLOSE_READER(re, s);
               ^
      228. }
      229. 

libavcodec/get_bits.h:228:1: return from a call to skip_bits
      226.     LAST_SKIP_BITS(re, s, n);
      227.     CLOSE_READER(re, s);
      228. }
           ^
      229. 
      230. static inline unsigned int get_bits1(GetBitContext *s){

libavcodec/get_bits.h:252:1: return from a call to skip_bits1
    250. static inline void skip_bits1(GetBitContext *s){
    251.     skip_bits(s, 1);
    252. }
         ^
    253. 
    254. /**

libavcodec/aacadtsdec.c:38:5: 
  36. 
  37.     skip_bits1(gbc);             /* id */
  38.     skip_bits(gbc, 2);           /* layer */
          ^
  39.     crc_abs = get_bits1(gbc);    /* protection_absent */
  40.     aot     = get_bits(gbc, 2);  /* profile_objecttype */

libavcodec/get_bits.h:222:1: start of procedure skip_bits()
    220. }
    221. 
    222. static inline void skip_bits(GetBitContext *s, int n){
         ^
    223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
    224.     OPEN_READER(re, s);

libavcodec/get_bits.h:224:5: 
    222. static inline void skip_bits(GetBitContext *s, int n){
    223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
    224.     OPEN_READER(re, s);
             ^
    225.     UPDATE_CACHE(re, s);
    226.     LAST_SKIP_BITS(re, s, n);

libavcodec/get_bits.h:225:5: 
    223.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
    224.     OPEN_READER(re, s);
    225.     UPDATE_CACHE(re, s);
             ^
    226.     LAST_SKIP_BITS(re, s, n);
    227.     CLOSE_READER(re, s);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
      64. 
      65. #ifndef av_bswap32
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
          ^
      67. {
      68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      67. {
      68.     return AV_BSWAP32C(x);
              ^
      69. }
      70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
      67. {
      68.     return AV_BSWAP32C(x);
      69. }
          ^
      70. #endif
      71. 

libavcodec/get_bits.h:226:5: 
    224.     OPEN_READER(re, s);
    225.     UPDATE_CACHE(re, s);
    226.     LAST_SKIP_BITS(re, s, n);
             ^
    227.     CLOSE_READER(re, s);
    228. }

libavcodec/get_bits.h:227:5: 
    225.     UPDATE_CACHE(re, s);
    226.     LAST_SKIP_BITS(re, s, n);
    227.     CLOSE_READER(re, s);
             ^
    228. }
    229. 

libavcodec/get_bits.h:228:1: return from a call to skip_bits
    226.     LAST_SKIP_BITS(re, s, n);
    227.     CLOSE_READER(re, s);
    228. }
         ^
    229. 
    230. static inline unsigned int get_bits1(GetBitContext *s){

libavcodec/aacadtsdec.c:39:5: 
  37.     skip_bits1(gbc);             /* id */
  38.     skip_bits(gbc, 2);           /* layer */
  39.     crc_abs = get_bits1(gbc);    /* protection_absent */
          ^
  40.     aot     = get_bits(gbc, 2);  /* profile_objecttype */
  41.     sr      = get_bits(gbc, 4);  /* sample_frequency_index */

libavcodec/get_bits.h:230:1: start of procedure get_bits1()
    228. }
    229. 
    230. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    231.     unsigned int index = s->index;
    232.     uint8_t result = s->buffer[index>>3];

libavcodec/get_bits.h:231:5: 
    229. 
    230. static inline unsigned int get_bits1(GetBitContext *s){
    231.     unsigned int index = s->index;
             ^
    232.     uint8_t result = s->buffer[index>>3];
    233. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:232:5: 
    230. static inline unsigned int get_bits1(GetBitContext *s){
    231.     unsigned int index = s->index;
    232.     uint8_t result = s->buffer[index>>3];
             ^
    233. #ifdef ALT_BITSTREAM_READER_LE
    234.     result >>= index & 7;

static int spdif_get_offset_and_codec(AVFormatContext *s,
                                      enum IEC61937DataType data_type,
                                      const char *buf, int *offset,
                                      enum CodecID *codec)
{
    AACADTSHeaderInfo aac_hdr;
    GetBitContext gbc;
    switch (data_type & 0xff) {
    case IEC61937_AC3:
        *offset = AC3_FRAME_SIZE << 2;
        *codec = CODEC_ID_AC3;
        break;
    case IEC61937_MPEG1_LAYER1:
        *offset = spdif_mpeg_pkt_offset[1][0];
        *codec = CODEC_ID_MP1;
        break;
    case IEC61937_MPEG1_LAYER23:
        *offset = spdif_mpeg_pkt_offset[1][0];
        *codec = CODEC_ID_MP3;
        break;
    case IEC61937_MPEG2_EXT:
        *offset = 4608;
        *codec = CODEC_ID_MP3;
        break;
    case IEC61937_MPEG2_AAC:
        init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
        if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {
            if (s)
                av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");
            return AVERROR_INVALIDDATA;
        }
        *offset = aac_hdr.samples << 2;
        *codec = CODEC_ID_AAC;
        break;
    case IEC61937_MPEG2_LAYER1_LSF:
        *offset = spdif_mpeg_pkt_offset[0][0];
        *codec = CODEC_ID_MP1;
        break;
    case IEC61937_MPEG2_LAYER2_LSF:
        *offset = spdif_mpeg_pkt_offset[0][1];
        *codec = CODEC_ID_MP2;
        break;
    case IEC61937_MPEG2_LAYER3_LSF:
        *offset = spdif_mpeg_pkt_offset[0][2];
        *codec = CODEC_ID_MP3;
        break;
    case IEC61937_DTS1:
        *offset = 2048;
        *codec = CODEC_ID_DTS;
        break;
    case IEC61937_DTS2:
        *offset = 4096;
        *codec = CODEC_ID_DTS;
        break;
    case IEC61937_DTS3:
        *offset = 8192;
        *codec = CODEC_ID_DTS;
        break;
    default:
        if (s) {
            av_log(s, AV_LOG_WARNING, "Data type 0x%04x", data_type);
            av_log_missing_feature(s, " in IEC 61937 is", 1);
        }
        return AVERROR_PATCHWELCOME;
    }
    return 0;
}
['static int spdif_get_offset_and_codec(AVFormatContext *s,\n                                      enum IEC61937DataType data_type,\n                                      const char *buf, int *offset,\n                                      enum CodecID *codec)\n{\n    AACADTSHeaderInfo aac_hdr;\n    GetBitContext gbc;\n    switch (data_type & 0xff) {\n    case IEC61937_AC3:\n        *offset = AC3_FRAME_SIZE << 2;\n        *codec = CODEC_ID_AC3;\n        break;\n    case IEC61937_MPEG1_LAYER1:\n        *offset = spdif_mpeg_pkt_offset[1][0];\n        *codec = CODEC_ID_MP1;\n        break;\n    case IEC61937_MPEG1_LAYER23:\n        *offset = spdif_mpeg_pkt_offset[1][0];\n        *codec = CODEC_ID_MP3;\n        break;\n    case IEC61937_MPEG2_EXT:\n        *offset = 4608;\n        *codec = CODEC_ID_MP3;\n        break;\n    case IEC61937_MPEG2_AAC:\n        init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);\n        if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {\n            if (s)\n                av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        *offset = aac_hdr.samples << 2;\n        *codec = CODEC_ID_AAC;\n        break;\n    case IEC61937_MPEG2_LAYER1_LSF:\n        *offset = spdif_mpeg_pkt_offset[0][0];\n        *codec = CODEC_ID_MP1;\n        break;\n    case IEC61937_MPEG2_LAYER2_LSF:\n        *offset = spdif_mpeg_pkt_offset[0][1];\n        *codec = CODEC_ID_MP2;\n        break;\n    case IEC61937_MPEG2_LAYER3_LSF:\n        *offset = spdif_mpeg_pkt_offset[0][2];\n        *codec = CODEC_ID_MP3;\n        break;\n    case IEC61937_DTS1:\n        *offset = 2048;\n        *codec = CODEC_ID_DTS;\n        break;\n    case IEC61937_DTS2:\n        *offset = 4096;\n        *codec = CODEC_ID_DTS;\n        break;\n    case IEC61937_DTS3:\n        *offset = 8192;\n        *codec = CODEC_ID_DTS;\n        break;\n    default:\n        if (s) {\n            av_log(s, AV_LOG_WARNING, "Data type 0x%04x", data_type);\n            av_log_missing_feature(s, " in IEC 61937 is", 1);\n        }\n        return AVERROR_PATCHWELCOME;\n    }\n    return 0;\n}', 'static inline void init_get_bits(GetBitContext *s,\n                   const uint8_t *buffer, int bit_size)\n{\n    int buffer_size = (bit_size+7)>>3;\n    if (buffer_size < 0 || bit_size < 0) {\n        buffer_size = bit_size = 0;\n        buffer = NULL;\n    }\n    s->buffer       = buffer;\n    s->size_in_bits = bit_size;\n    s->buffer_end   = buffer + buffer_size;\n    s->index        = 0;\n}', 'int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)\n{\n    int size, rdb, ch, sr;\n    int aot, crc_abs;\n    if(get_bits(gbc, 12) != 0xfff)\n        return AAC_AC3_PARSE_ERROR_SYNC;\n    skip_bits1(gbc);\n    skip_bits(gbc, 2);\n    crc_abs = get_bits1(gbc);\n    aot     = get_bits(gbc, 2);\n    sr      = get_bits(gbc, 4);\n    if(!avpriv_mpeg4audio_sample_rates[sr])\n        return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;\n    skip_bits1(gbc);\n    ch      = get_bits(gbc, 3);\n    skip_bits1(gbc);\n    skip_bits1(gbc);\n    skip_bits1(gbc);\n    skip_bits1(gbc);\n    size    = get_bits(gbc, 13);\n    if(size < AAC_ADTS_HEADER_SIZE)\n        return AAC_AC3_PARSE_ERROR_FRAME_SIZE;\n    skip_bits(gbc, 11);\n    rdb = get_bits(gbc, 2);\n    hdr->object_type    = aot + 1;\n    hdr->chan_config    = ch;\n    hdr->crc_absent     = crc_abs;\n    hdr->num_aac_frames = rdb + 1;\n    hdr->sampling_index = sr;\n    hdr->sample_rate    = avpriv_mpeg4audio_sample_rates[sr];\n    hdr->samples        = (rdb + 1) * 1024;\n    hdr->bit_rate       = size * 8 * hdr->sample_rate / hdr->samples;\n    return size;\n}', 'static inline unsigned int get_bits(GetBitContext *s, int n){\n    register int tmp;\n    OPEN_READER(re, s);\n    UPDATE_CACHE(re, s);\n    tmp = SHOW_UBITS(re, s, n);\n    LAST_SKIP_BITS(re, s, n);\n    CLOSE_READER(re, s);\n    return tmp;\n}', 'static av_always_inline av_const uint32_t av_bswap32(uint32_t x)\n{\n    return AV_BSWAP32C(x);\n}', 'static inline void skip_bits1(GetBitContext *s){\n    skip_bits(s, 1);\n}', 'static inline void skip_bits(GetBitContext *s, int n){\n    OPEN_READER(re, s);\n    UPDATE_CACHE(re, s);\n    LAST_SKIP_BITS(re, s, n);\n    CLOSE_READER(re, s);\n}', 'static inline unsigned int get_bits1(GetBitContext *s){\n    unsigned int index = s->index;\n    uint8_t result = s->buffer[index>>3];\n#ifdef ALT_BITSTREAM_READER_LE\n    result >>= index & 7;\n    result &= 1;\n#else\n    result <<= index & 7;\n    result >>= 8 - 1;\n#endif\n    index++;\n    s->index = index;\n    return result;\n}']