libavcodec/escape130.c:238: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 219 could be null and is dereferenced by call to `decode_skip_count()` at line 238, column 20.

libavcodec/escape130.c:189:1: start of procedure escape130_decode_frame()
187. }
188. 
189. static int escape130_decode_frame(AVCodecContext *avctx, void *data,
     ^
190.                                   int *got_frame, AVPacket *avpkt)
191. {

libavcodec/escape130.c:192:5: 
190.                                   int *got_frame, AVPacket *avpkt)
191. {
192.     const uint8_t *buf  = avpkt->data;
         ^
193.     int buf_size        = avpkt->size;
194.     Escape130Context *s = avctx->priv_data;

libavcodec/escape130.c:193:5: 
191. {
192.     const uint8_t *buf  = avpkt->data;
193.     int buf_size        = avpkt->size;
         ^
194.     Escape130Context *s = avctx->priv_data;
195.     AVFrame *pic        = data;

libavcodec/escape130.c:194:5: 
192.     const uint8_t *buf  = avpkt->data;
193.     int buf_size        = avpkt->size;
194.     Escape130Context *s = avctx->priv_data;
         ^
195.     AVFrame *pic        = data;
196.     GetBitContext gb;

libavcodec/escape130.c:195:5: 
193.     int buf_size        = avpkt->size;
194.     Escape130Context *s = avctx->priv_data;
195.     AVFrame *pic        = data;
         ^
196.     GetBitContext gb;
197.     int ret;

libavcodec/escape130.c:204:5: 
202.     unsigned old_y_stride, old_cb_stride, old_cr_stride,
203.              new_y_stride, new_cb_stride, new_cr_stride;
204.     unsigned total_blocks = avctx->width * avctx->height / 4,
         ^
205.              block_index, block_x = 0;
206.     unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;

libavcodec/escape130.c:206:5: 
204.     unsigned total_blocks = avctx->width * avctx->height / 4,
205.              block_index, block_x = 0;
206.     unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
         ^
207.     int skip = -1, y_avg = 0, i, j;
208.     uint8_t *ya = s->old_y_avg;

libavcodec/escape130.c:207:5: 
205.              block_index, block_x = 0;
206.     unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
207.     int skip = -1, y_avg = 0, i, j;
         ^
208.     uint8_t *ya = s->old_y_avg;
209. 

libavcodec/escape130.c:208:5: 
206.     unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
207.     int skip = -1, y_avg = 0, i, j;
208.     uint8_t *ya = s->old_y_avg;
         ^
209. 
210.     // first 16 bytes are header; no useful information in here

libavcodec/escape130.c:211:9: Taking false branch
209. 
210.     // first 16 bytes are header; no useful information in here
211.     if (buf_size <= 16) {
             ^
212.         av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n");
213.         return AVERROR_INVALIDDATA;

libavcodec/escape130.c:216:9: Taking false branch
214.     }
215. 
216.     if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
             ^
217.         return ret;
218. 

libavcodec/escape130.c:219:5: 
217.         return ret;
218. 
219.     init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
         ^
220. 
221.     new_y  = s->new_y;

libavcodec/get_bits.h:362:1: start of procedure init_get_bits()
  360.  * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
  361.  */
  362. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
       ^
  363.                                 int bit_size)
  364. {

libavcodec/get_bits.h:366:5: 
  364. {
  365.     int buffer_size;
  366.     int ret = 0;
           ^
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {

libavcodec/get_bits.h:368:9: Taking true branch
  366.     int ret = 0;
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
               ^
  369.         bit_size    = 0;
  370.         buffer      = NULL;

libavcodec/get_bits.h:369:9: 
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  369.         bit_size    = 0;
               ^
  370.         buffer      = NULL;
  371.         ret         = AVERROR_INVALIDDATA;

libavcodec/get_bits.h:370:9: 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  369.         bit_size    = 0;
  370.         buffer      = NULL;
               ^
  371.         ret         = AVERROR_INVALIDDATA;
  372.     }

libavcodec/get_bits.h:371:9: 
  369.         bit_size    = 0;
  370.         buffer      = NULL;
  371.         ret         = AVERROR_INVALIDDATA;
               ^
  372.     }
  373. 

libavcodec/get_bits.h:374:5: 
  372.     }
  373. 
  374.     buffer_size = (bit_size + 7) >> 3;
           ^
  375. 
  376.     s->buffer             = buffer;

libavcodec/get_bits.h:376:5: 
  374.     buffer_size = (bit_size + 7) >> 3;
  375. 
  376.     s->buffer             = buffer;
           ^
  377.     s->size_in_bits       = bit_size;
  378. #if !UNCHECKED_BITSTREAM_READER

libavcodec/get_bits.h:377:5: 
  375. 
  376.     s->buffer             = buffer;
  377.     s->size_in_bits       = bit_size;
           ^
  378. #if !UNCHECKED_BITSTREAM_READER
  379.     s->size_in_bits_plus8 = bit_size + 8;

libavcodec/get_bits.h:379:5: 
  377.     s->size_in_bits       = bit_size;
  378. #if !UNCHECKED_BITSTREAM_READER
  379.     s->size_in_bits_plus8 = bit_size + 8;
           ^
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;

libavcodec/get_bits.h:381:5: 
  379.     s->size_in_bits_plus8 = bit_size + 8;
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;
           ^
  382.     s->index              = 0;
  383. 

libavcodec/get_bits.h:382:5: 
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;
  382.     s->index              = 0;
           ^
  383. 
  384.     return ret;

libavcodec/get_bits.h:384:5: 
  382.     s->index              = 0;
  383. 
  384.     return ret;
           ^
  385. }
  386. 

libavcodec/get_bits.h:385:1: return from a call to init_get_bits
  383. 
  384.     return ret;
  385. }
       ^
  386. 
  387. /**

libavcodec/escape130.c:221:5: 
219.     init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
220. 
221.     new_y  = s->new_y;
         ^
222.     new_cb = s->new_u;
223.     new_cr = s->new_v;

libavcodec/escape130.c:222:5: 
220. 
221.     new_y  = s->new_y;
222.     new_cb = s->new_u;
         ^
223.     new_cr = s->new_v;
224.     new_y_stride  = s->linesize[0];

libavcodec/escape130.c:223:5: 
221.     new_y  = s->new_y;
222.     new_cb = s->new_u;
223.     new_cr = s->new_v;
         ^
224.     new_y_stride  = s->linesize[0];
225.     new_cb_stride = s->linesize[1];

libavcodec/escape130.c:224:5: 
222.     new_cb = s->new_u;
223.     new_cr = s->new_v;
224.     new_y_stride  = s->linesize[0];
         ^
225.     new_cb_stride = s->linesize[1];
226.     new_cr_stride = s->linesize[2];

libavcodec/escape130.c:225:5: 
223.     new_cr = s->new_v;
224.     new_y_stride  = s->linesize[0];
225.     new_cb_stride = s->linesize[1];
         ^
226.     new_cr_stride = s->linesize[2];
227.     old_y  = s->old_y;

libavcodec/escape130.c:226:5: 
224.     new_y_stride  = s->linesize[0];
225.     new_cb_stride = s->linesize[1];
226.     new_cr_stride = s->linesize[2];
         ^
227.     old_y  = s->old_y;
228.     old_cb = s->old_u;

libavcodec/escape130.c:227:5: 
225.     new_cb_stride = s->linesize[1];
226.     new_cr_stride = s->linesize[2];
227.     old_y  = s->old_y;
         ^
228.     old_cb = s->old_u;
229.     old_cr = s->old_v;

libavcodec/escape130.c:228:5: 
226.     new_cr_stride = s->linesize[2];
227.     old_y  = s->old_y;
228.     old_cb = s->old_u;
         ^
229.     old_cr = s->old_v;
230.     old_y_stride  = s->linesize[0];

libavcodec/escape130.c:229:5: 
227.     old_y  = s->old_y;
228.     old_cb = s->old_u;
229.     old_cr = s->old_v;
         ^
230.     old_y_stride  = s->linesize[0];
231.     old_cb_stride = s->linesize[1];

libavcodec/escape130.c:230:5: 
228.     old_cb = s->old_u;
229.     old_cr = s->old_v;
230.     old_y_stride  = s->linesize[0];
         ^
231.     old_cb_stride = s->linesize[1];
232.     old_cr_stride = s->linesize[2];

libavcodec/escape130.c:231:5: 
229.     old_cr = s->old_v;
230.     old_y_stride  = s->linesize[0];
231.     old_cb_stride = s->linesize[1];
         ^
232.     old_cr_stride = s->linesize[2];
233. 

libavcodec/escape130.c:232:5: 
230.     old_y_stride  = s->linesize[0];
231.     old_cb_stride = s->linesize[1];
232.     old_cr_stride = s->linesize[2];
         ^
233. 
234.     for (block_index = 0; block_index < total_blocks; block_index++) {

libavcodec/escape130.c:234:10: 
232.     old_cr_stride = s->linesize[2];
233. 
234.     for (block_index = 0; block_index < total_blocks; block_index++) {
              ^
235.         // Note that this call will make us skip the rest of the blocks
236.         // if the frame ends prematurely.

libavcodec/escape130.c:234:27: Loop condition is true. Entering loop body
232.     old_cr_stride = s->linesize[2];
233. 
234.     for (block_index = 0; block_index < total_blocks; block_index++) {
                               ^
235.         // Note that this call will make us skip the rest of the blocks
236.         // if the frame ends prematurely.

libavcodec/escape130.c:237:13: Taking true branch
235.         // Note that this call will make us skip the rest of the blocks
236.         // if the frame ends prematurely.
237.         if (skip == -1)
                 ^
238.             skip = decode_skip_count(&gb);
239.         if (skip == -1) {

libavcodec/escape130.c:238:13: 
236.         // if the frame ends prematurely.
237.         if (skip == -1)
238.             skip = decode_skip_count(&gb);
                 ^
239.         if (skip == -1) {
240.             av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n");

libavcodec/escape130.c:166:1: start of procedure decode_skip_count()
  164. }
  165. 
  166. static int decode_skip_count(GetBitContext* gb)
       ^
  167. {
  168.     int value;

libavcodec/escape130.c:170:5: 
  168.     int value;
  169. 
  170.     value = get_bits1(gb);
           ^
  171.     if (value)
  172.         return 0;

libavcodec/get_bits.h:267:1: start of procedure get_bits1()
    265. }
    266. 
    267. static inline unsigned int get_bits1(GetBitContext *s)
         ^
    268. {
    269.     unsigned int index = s->index;

libavcodec/get_bits.h:269:5: 
    267. static inline unsigned int get_bits1(GetBitContext *s)
    268. {
    269.     unsigned int index = s->index;
             ^
    270.     uint8_t result     = s->buffer[index >> 3];
    271. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:270:5: 
    268. {
    269.     unsigned int index = s->index;
    270.     uint8_t result     = s->buffer[index >> 3];
             ^
    271. #ifdef BITSTREAM_READER_LE
    272.     result >>= index & 7;

static int escape130_decode_frame(AVCodecContext *avctx, void *data,
                                  int *got_frame, AVPacket *avpkt)
{
    const uint8_t *buf  = avpkt->data;
    int buf_size        = avpkt->size;
    Escape130Context *s = avctx->priv_data;
    AVFrame *pic        = data;
    GetBitContext gb;
    int ret;
    uint8_t *old_y, *old_cb, *old_cr,
            *new_y, *new_cb, *new_cr;
    uint8_t *dstY, *dstU, *dstV;
    unsigned old_y_stride, old_cb_stride, old_cr_stride,
             new_y_stride, new_cb_stride, new_cr_stride;
    unsigned total_blocks = avctx->width * avctx->height / 4,
             block_index, block_x = 0;
    unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
    int skip = -1, y_avg = 0, i, j;
    uint8_t *ya = s->old_y_avg;
    if (buf_size <= 16) {
        av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n");
        return AVERROR_INVALIDDATA;
    }
    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
        return ret;
    init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
    new_y  = s->new_y;
    new_cb = s->new_u;
    new_cr = s->new_v;
    new_y_stride  = s->linesize[0];
    new_cb_stride = s->linesize[1];
    new_cr_stride = s->linesize[2];
    old_y  = s->old_y;
    old_cb = s->old_u;
    old_cr = s->old_v;
    old_y_stride  = s->linesize[0];
    old_cb_stride = s->linesize[1];
    old_cr_stride = s->linesize[2];
    for (block_index = 0; block_index < total_blocks; block_index++) {
        if (skip == -1)
            skip = decode_skip_count(&gb);
        if (skip == -1) {
            av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n");
            return AVERROR_INVALIDDATA;
        }
        if (skip) {
            y[0] = old_y[0];
            y[1] = old_y[1];
            y[2] = old_y[old_y_stride];
            y[3] = old_y[old_y_stride + 1];
            y_avg = ya[0];
            cb = old_cb[0];
            cr = old_cr[0];
        } else {
            if (get_bits1(&gb)) {
                unsigned sign_selector       = get_bits(&gb, 6);
                unsigned difference_selector = get_bits(&gb, 2);
                y_avg = 2 * get_bits(&gb, 5);
                for (i = 0; i < 4; i++) {
                    y[i] = av_clip(y_avg + offset_table[difference_selector] *
                                   sign_table[sign_selector][i], 0, 63);
                }
            } else if (get_bits1(&gb)) {
                if (get_bits1(&gb)) {
                    y_avg = get_bits(&gb, 6);
                } else {
                    unsigned adjust_index = get_bits(&gb, 3);
                    y_avg = (y_avg + luma_adjust[adjust_index]) & 63;
                }
                for (i = 0; i < 4; i++)
                    y[i] = y_avg;
            }
            if (get_bits1(&gb)) {
                if (get_bits1(&gb)) {
                    cb = get_bits(&gb, 5);
                    cr = get_bits(&gb, 5);
                } else {
                    unsigned adjust_index = get_bits(&gb, 3);
                    cb = (cb + chroma_adjust[0][adjust_index]) & 31;
                    cr = (cr + chroma_adjust[1][adjust_index]) & 31;
                }
            }
        }
        *ya++ = y_avg;
        new_y[0]                = y[0];
        new_y[1]                = y[1];
        new_y[new_y_stride]     = y[2];
        new_y[new_y_stride + 1] = y[3];
        *new_cb = cb;
        *new_cr = cr;
        old_y += 2;
        old_cb++;
        old_cr++;
        new_y += 2;
        new_cb++;
        new_cr++;
        block_x++;
        if (block_x * 2 == avctx->width) {
            block_x = 0;
            old_y  += old_y_stride * 2  - avctx->width;
            old_cb += old_cb_stride     - avctx->width / 2;
            old_cr += old_cr_stride     - avctx->width / 2;
            new_y  += new_y_stride * 2  - avctx->width;
            new_cb += new_cb_stride     - avctx->width / 2;
            new_cr += new_cr_stride     - avctx->width / 2;
        }
        skip--;
    }
    new_y  = s->new_y;
    new_cb = s->new_u;
    new_cr = s->new_v;
    dstY   = pic->data[0];
    dstU   = pic->data[1];
    dstV   = pic->data[2];
    for (j = 0; j < avctx->height; j++) {
        for (i = 0; i < avctx->width; i++)
            dstY[i] = new_y[i] << 2;
        dstY  += pic->linesize[0];
        new_y += new_y_stride;
    }
    for (j = 0; j < avctx->height / 2; j++) {
        for (i = 0; i < avctx->width / 2; i++) {
            dstU[i] = chroma_vals[new_cb[i]];
            dstV[i] = chroma_vals[new_cr[i]];
        }
        dstU   += pic->linesize[1];
        dstV   += pic->linesize[2];
        new_cb += new_cb_stride;
        new_cr += new_cr_stride;
    }
    ff_dlog(avctx, "Frame data: provided %d bytes, used %d bytes\n",
            buf_size, get_bits_count(&gb) >> 3);
    FFSWAP(uint8_t*, s->old_y, s->new_y);
    FFSWAP(uint8_t*, s->old_u, s->new_u);
    FFSWAP(uint8_t*, s->old_v, s->new_v);
    *got_frame = 1;
    return buf_size;
}
['static int escape130_decode_frame(AVCodecContext *avctx, void *data,\n                                  int *got_frame, AVPacket *avpkt)\n{\n    const uint8_t *buf  = avpkt->data;\n    int buf_size        = avpkt->size;\n    Escape130Context *s = avctx->priv_data;\n    AVFrame *pic        = data;\n    GetBitContext gb;\n    int ret;\n    uint8_t *old_y, *old_cb, *old_cr,\n            *new_y, *new_cb, *new_cr;\n    uint8_t *dstY, *dstU, *dstV;\n    unsigned old_y_stride, old_cb_stride, old_cr_stride,\n             new_y_stride, new_cb_stride, new_cr_stride;\n    unsigned total_blocks = avctx->width * avctx->height / 4,\n             block_index, block_x = 0;\n    unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;\n    int skip = -1, y_avg = 0, i, j;\n    uint8_t *ya = s->old_y_avg;\n    if (buf_size <= 16) {\n        av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)\n        return ret;\n    init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);\n    new_y  = s->new_y;\n    new_cb = s->new_u;\n    new_cr = s->new_v;\n    new_y_stride  = s->linesize[0];\n    new_cb_stride = s->linesize[1];\n    new_cr_stride = s->linesize[2];\n    old_y  = s->old_y;\n    old_cb = s->old_u;\n    old_cr = s->old_v;\n    old_y_stride  = s->linesize[0];\n    old_cb_stride = s->linesize[1];\n    old_cr_stride = s->linesize[2];\n    for (block_index = 0; block_index < total_blocks; block_index++) {\n        if (skip == -1)\n            skip = decode_skip_count(&gb);\n        if (skip == -1) {\n            av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        if (skip) {\n            y[0] = old_y[0];\n            y[1] = old_y[1];\n            y[2] = old_y[old_y_stride];\n            y[3] = old_y[old_y_stride + 1];\n            y_avg = ya[0];\n            cb = old_cb[0];\n            cr = old_cr[0];\n        } else {\n            if (get_bits1(&gb)) {\n                unsigned sign_selector       = get_bits(&gb, 6);\n                unsigned difference_selector = get_bits(&gb, 2);\n                y_avg = 2 * get_bits(&gb, 5);\n                for (i = 0; i < 4; i++) {\n                    y[i] = av_clip(y_avg + offset_table[difference_selector] *\n                                   sign_table[sign_selector][i], 0, 63);\n                }\n            } else if (get_bits1(&gb)) {\n                if (get_bits1(&gb)) {\n                    y_avg = get_bits(&gb, 6);\n                } else {\n                    unsigned adjust_index = get_bits(&gb, 3);\n                    y_avg = (y_avg + luma_adjust[adjust_index]) & 63;\n                }\n                for (i = 0; i < 4; i++)\n                    y[i] = y_avg;\n            }\n            if (get_bits1(&gb)) {\n                if (get_bits1(&gb)) {\n                    cb = get_bits(&gb, 5);\n                    cr = get_bits(&gb, 5);\n                } else {\n                    unsigned adjust_index = get_bits(&gb, 3);\n                    cb = (cb + chroma_adjust[0][adjust_index]) & 31;\n                    cr = (cr + chroma_adjust[1][adjust_index]) & 31;\n                }\n            }\n        }\n        *ya++ = y_avg;\n        new_y[0]                = y[0];\n        new_y[1]                = y[1];\n        new_y[new_y_stride]     = y[2];\n        new_y[new_y_stride + 1] = y[3];\n        *new_cb = cb;\n        *new_cr = cr;\n        old_y += 2;\n        old_cb++;\n        old_cr++;\n        new_y += 2;\n        new_cb++;\n        new_cr++;\n        block_x++;\n        if (block_x * 2 == avctx->width) {\n            block_x = 0;\n            old_y  += old_y_stride * 2  - avctx->width;\n            old_cb += old_cb_stride     - avctx->width / 2;\n            old_cr += old_cr_stride     - avctx->width / 2;\n            new_y  += new_y_stride * 2  - avctx->width;\n            new_cb += new_cb_stride     - avctx->width / 2;\n            new_cr += new_cr_stride     - avctx->width / 2;\n        }\n        skip--;\n    }\n    new_y  = s->new_y;\n    new_cb = s->new_u;\n    new_cr = s->new_v;\n    dstY   = pic->data[0];\n    dstU   = pic->data[1];\n    dstV   = pic->data[2];\n    for (j = 0; j < avctx->height; j++) {\n        for (i = 0; i < avctx->width; i++)\n            dstY[i] = new_y[i] << 2;\n        dstY  += pic->linesize[0];\n        new_y += new_y_stride;\n    }\n    for (j = 0; j < avctx->height / 2; j++) {\n        for (i = 0; i < avctx->width / 2; i++) {\n            dstU[i] = chroma_vals[new_cb[i]];\n            dstV[i] = chroma_vals[new_cr[i]];\n        }\n        dstU   += pic->linesize[1];\n        dstV   += pic->linesize[2];\n        new_cb += new_cb_stride;\n        new_cr += new_cr_stride;\n    }\n    ff_dlog(avctx, "Frame data: provided %d bytes, used %d bytes\\n",\n            buf_size, get_bits_count(&gb) >> 3);\n    FFSWAP(uint8_t*, s->old_y, s->new_y);\n    FFSWAP(uint8_t*, s->old_u, s->new_u);\n    FFSWAP(uint8_t*, s->old_v, s->new_v);\n    *got_frame = 1;\n    return buf_size;\n}', 'static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,\n                                int bit_size)\n{\n    int buffer_size;\n    int ret = 0;\n    if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {\n        bit_size    = 0;\n        buffer      = NULL;\n        ret         = AVERROR_INVALIDDATA;\n    }\n    buffer_size = (bit_size + 7) >> 3;\n    s->buffer             = buffer;\n    s->size_in_bits       = bit_size;\n#if !UNCHECKED_BITSTREAM_READER\n    s->size_in_bits_plus8 = bit_size + 8;\n#endif\n    s->buffer_end         = buffer + buffer_size;\n    s->index              = 0;\n    return ret;\n}', 'static int decode_skip_count(GetBitContext* gb)\n{\n    int value;\n    value = get_bits1(gb);\n    if (value)\n        return 0;\n    value = get_bits(gb, 3);\n    if (value)\n        return value;\n    value = get_bits(gb, 8);\n    if (value)\n        return value + 7;\n    value = get_bits(gb, 15);\n    if (value)\n        return value + 262;\n    return -1;\n}', 'static inline unsigned int get_bits1(GetBitContext *s)\n{\n    unsigned int index = s->index;\n    uint8_t result     = s->buffer[index >> 3];\n#ifdef BITSTREAM_READER_LE\n    result >>= index & 7;\n    result  &= 1;\n#else\n    result <<= index & 7;\n    result >>= 8 - 1;\n#endif\n#if !UNCHECKED_BITSTREAM_READER\n    if (s->index < s->size_in_bits_plus8)\n#endif\n        index++;\n    s->index = index;\n    return result;\n}']